Knowledge / Computer Applications / Discrete mathematics for computing

Discrete mathematics for computing

Computer Applications (BCA) · Mathematics and business · free study notes for exams, placements and interviews

In short

Discrete mathematics is the study of countable, separated structures — sets, logic statements, relations, functions, counting arrangements, recurrences and algebraic systems — as opposed to the continuous quantities of calculus. It is the formal language of computing: databases rest on set theory and relations, circuits and conditions on Boolean logic, program correctness on induction, algorithm cost on recurrences and counting, and cryptography on modular arithmetic and groups. Indian universities examine it in BCA/MCA semester papers under UGC CBCS and the AICTE model curriculum, and GATE CS devotes roughly 8–12 marks a year to it. Placement tests at TCS, Infosys, Wipro, Cognizant, Accenture and Capgemini draw aptitude and reasoning questions directly from counting, probability basics and logic, while product-company interviews probe recursion, induction and combinatorial reasoning.

Explained

Sets, relations and functions

Propositional and predicate logic

Counting, pigeonhole and recurrences

Boolean algebra and logic simplification

Lattices, algebraic structures and number theory

Automata, grammars and countability (where the syllabus extends)

Key points

Formulas and examples

|P(A)| = 2ⁿ — subsets of an n-element set (n = cardinality, dimensionless count)
|A∪B| = |A| + |B| − |A∩B|; |A∪B∪C| = |A|+|B|+|C| − |A∩B| − |B∩C| − |A∩C| + |A∩B∩C|
Relations on an n-set = 2n²; reflexive relations = 2n²−n; symmetric relations = 2n(n+1)/2
ⁿPᵣ = n!/(n−r)!; ⁿCᵣ = n!/(r!(n−r)!); circular permutations = (n−1)!
Selections with repetition = ⁿ⁺ʳ⁻¹Cᵣ; arrangements with repeats = n!/(n₁!n₂!…nₖ!)
Generalised pigeonhole: minimum in the fullest box = ⌈n/m⌉ (n items, m boxes)
Linear recurrence aₙ = c₁aₙ₋₁ + c₂aₙ₋₂ → r² − c₁r − c₂ = 0; aₙ = A r₁ⁿ + B r₂ⁿ (distinct roots)
Functions A→B = |B|^|A|; minterms for n variables = 2ⁿ; Boolean functions of n variables = 22ⁿ
aφ(n) ≡ 1 (mod n) when gcd(a,n)=1; φ(p) = p−1 for prime p; φ(pq) = (p−1)(q−1) for distinct primes p, q

Example 1 — Inclusion–exclusion, a BCA class. Of 120 students, 65 know C, 50 know Java, 45 know Python; 25 know C and Java, 20 know C and Python, 15 know Java and Python, and 8 know all three. How many know at least one, and how many none?

Example 2 — Counting passwords (product rule and subtraction). A portal needs a 5-character password from 26 lowercase letters and 10 digits, with at least one digit.

Example 3 — Solving a recurrence. Solve aₙ = 5aₙ₋₁ − 6aₙ₋₂ with a₀ = 1, a₁ = 4.

  1. Characteristic equation r² − 5r + 6 = 0 → (r−2)(r−3) = 0 → r = 2, 3.
  2. General solution aₙ = A·2ⁿ + B·3ⁿ.
  3. n=0: A + B = 1. n=1: 2A + 3B = 4 → subtracting twice the first: B = 2, so A = −1.
  4. aₙ = 2·3ⁿ − 2ⁿ. Check a₂ = 2·9 − 4 = 14, and 5(4) − 6(1) = 14. ✓

Example 4 — Truth table and validity. Is (p→q) ∧ (q→r) ⇒ (p→r) valid?

pqrp→qq→rpremise ∧p→r
TTTTTTT
TTFTFFF
TFTFTFT
TFFFTFF
FTTTTTT
FTFTFFT
FFTTTTT
FFFTTTT

Example 5 — K-map simplification. Minimise F(A,B,C,D) = Σm(0,1,2,3,8,9,10,11).

Example 6 — Pigeonhole and modular arithmetic. Among any 13 students, at least how many share a birth month, and how many users choosing 4-digit PINs are needed before a collision is certain?

StructureNeedsExample
Semigroupclosure, associativity(Z⁺, +)
Monoid+ identity(Z, ×), identity 1
Group+ inverses(Z, +), (Zₙ, +ₙ)
Abelian group+ commutativity(Z, +)
Fieldtwo ops, inverses for non-zeroGF(2), Q, R

Where it is used

Interview questions

Common mistakes

Related topics

Graph theory basics · Data structures and algorithms · Digital logic and computer organisation · Theory of computation and automata · Probability and combinatorics · Cryptography and information security

Open in the Knowledge reader →Find jobs →