allama Iqbal International University
Assignment :1
Subject : Discrete Math 3516
Sunmitted by :
Mian Abd ur Rehman Ijaz
user id: 0000955057
Submitted To:
Sir Tahir Ayub
Class :
BS Artificial Intelligence
Discrete Mathematics - Assignment No. 01
Q1: Explain Discrete Mathematics along with its applications.
Discrete Mathematics is the study of mathematical structures that are countable or
otherwise distinct and separable. It includes topics like logic, set theory,
combinatorics, graph theory, and algorithms.
Applications:
- Computer Science: Data structures, algorithms, databases, and cryptography.
- Networking: Graph theory is used in networking and pathfinding.
- Artificial Intelligence: Logic and set theory are widely used in AI.
- Software Engineering: Used in modeling software behavior and design.
Q2: Explain Different Gates and Truth Table.
Logic Gates:
1. AND Gate: Output is true only if all inputs are true.
2. OR Gate: Output is true if at least one input is true.
3. NOT Gate: Inverts the input.
4. NAND Gate: Opposite of AND.
5. NOR Gate: Opposite of OR.
6. XOR Gate: True if inputs are different.
7. XNOR Gate: True if inputs are the same.
0|0| 0
0|1| 0
1|0| 0
1|1| 1
Example Truth Table
for AND gate: A | B |
A AND B
Q3: Define and Explain Counting Principle.
Counting Principle:
If an event can occur in m ways and another event in n ways, then both events together
can occur in m × n ways.
Example:
If you have 3 shirts and 2 pants, then you have 3 × 2 = 6 outfit combinations.
Q4: Explain Different Identities Like Commutative Law, Distributive Law,
Associative Law, Idempotent Law with Examples.
1. Commutative Law:
-A+B=B+A
-A×B=B×A
2. Associative Law:
- (A + B) + C = A + (B + C)
- (A × B) × C = A × (B × C)
3. Distributive Law:
- A × (B + C) = A × B + A × C
4. Idempotent Law:
-A+A=A
-A×A=A
Q5: Explain Different Types of Relations with Examples.
Types of Relations:
1. Reflexive: aRa for all a in A.
Example: A = {1, 2}, R = {(1,1), (2,2)}
2. Symmetric: If aRb then
bRa. Example: R = {(1,2),
(2,1)}
3. Transitive: If aRb and bRc then
aRc. Example: R = {(1,2), (2,3),
(1,3)}
4. Antisymmetric: If aRb and bRa then a
= b. Example: R = {(1,1), (2,2), (1,2)}