ALANYA ALAADDİN KEYKUBAT UNIVERSITY
DEPARTMENT OF COMPUTER ENGINEERING
2024-2025 SPRING SEMESTER DISCRETE MATHEMATICS
HOMEWORK-1
Student Number: Name-Surname:
1. Check whether ((p → q) → (r →s)) and ((p→r) → (q→s)) are logically equivalent
• Using truth table
• Implementing in any programming language
2. In the following table, there are some example problems of discrete mathematics concepts where
it can be implemented. Depending on the last digit of your student number, write the code of the
example problem in any programming language. Note: For example; your student number is
130204041. It means that you will write the code of the problem 1- Matrix Operations
0 Prime Number Generation: Write a function to generate prime numbers up to a given limit.
Matrix Operations: Implement functions for matrix addition, subtraction, multiplication,
1
and transpose.
2 Generating Subsets: Write a function to generate all possible subsets of a set.
Pascal’s Triangle: Write a function to generate Pascal’s triangle up to a specified number of
3
rows.
Reflexivity, Symmetry, and Transitivity: Write a function that returns reflexivity,
4
symmetry, and transitivity of the relation.
Set Operations: Write functions to perform set operations such as union, intersection,
5
difference, and complement on sets of integers or strings.
Modular Exponentiation: Write a function to find the result for a given base, exponent, and
6
modulus.
7 Combinatorics: Write a function to calculate permutations of a string using recursion.
8 Truth Table in Logic: Write a function to generate truth tables for a given logical expression.
Tautology and Contradiction: Write a function to find the given logical expression is
9
tautology, contradiction, or neither.