Relation r(A, B, C, D) holds the tuples (a1, b1, c1, d1), (a1, b1, c2, d2), (a2, b2, c1, d3), (a3, b2, c3, d3). Which of these FDs are violated: A → B, B → A, A → C, D → B, C → B, AC → D?
A functional dependency X → Y says that tuples agreeing on X must agree on Y. Armstrong's axioms, attribute closure X⁺, candidate-key finding, F⁺, equivalence of FD sets and minimal covers form the toolkit behind normalization — and behind many PSC numericals.
For attribute sets X and Y of a relation R, the functional dependency X → Y (read 'X functionally determines Y', or 'Y is functionally dependent on X') holds if, in every legal instance of R, any two tuples that have the same values for X also have the same values for Y. X is the determinant (left-hand side) and Y the dependent (right-hand side).
FDs come from the meaning of the data. In the sample schema: emp_id → ename, job, salary, hire_date, dept_id, manager_id (an employee has one of each); dept_id → dname, location; dname → dept_id (names are unique); proj_id → pname, dept_id, budget; and {emp_id, proj_id} → hours. ename → salary does not hold — two employees could share a name but not a salary.
A key is the special case where the dependent side is everything: K is a superkey of R exactly when K → R. FDs generalise keys by describing which attributes determine some other attributes — and redundancy appears precisely when a determinant is not a key of its table.
| Kind | Condition | Example |
|---|---|---|
| Trivial | Y ⊆ X — always holds, says nothing | {emp_id, ename} → ename; A → A; AB → B |
| Non-trivial | Y ⊄ X — at least one new attribute on the right | emp_id → salary; AB → BC |
| Completely non-trivial | X ∩ Y = ∅ — no attribute repeated | emp_id → salary; AB → C |
Normal-form definitions always speak of non-trivial FDs, because trivial ones hold in every relation and cause no redundancy. Every FD can be split into a trivial part and a completely non-trivial part: AB → BC is equivalent to AB → C once the trivial AB → B is discarded.
Given a set F of FDs, other FDs follow logically. W. W. Armstrong (1974) gave three inference rules that are sound (they derive only FDs that really follow) and complete (repeated use derives every FD that follows). The set of all FDs implied by F is the closure F⁺.
| Rule | Statement | Why it holds |
|---|---|---|
| Reflexivity (axiom) | If Y ⊆ X then X → Y | Tuples equal on X are equal on any part of X |
| Augmentation (axiom) | If X → Y then XZ → YZ | Adding the same attributes to both sides keeps agreement |
| Transitivity (axiom) | If X → Y and Y → Z then X → Z | Agreement on X forces Y, which forces Z |
| Union (derived) | If X → Y and X → Z then X → YZ | Augment X → Y by X (X → XY), augment X → Z by Y (XY → YZ), then transitivity |
| Decomposition (derived) | If X → YZ then X → Y and X → Z | YZ → Y by reflexivity, then transitivity |
| Pseudotransitivity (derived) | If X → Y and WY → Z then WX → Z | Augment X → Y by W (WX → WY), then transitivity with WY → Z |
| Composition (derived) | If X → Y and Z → W then XZ → YW | Augment each and combine with union |
Computing F⁺ by applying axioms is exponential. Almost every practical question is answered instead with the closure of an attribute set: X⁺ (under F) is the set of all attributes functionally determined by X.
Brute force — test the closure of every subset — works but is slow by hand. Classifying attributes by where they appear in F cuts the search down dramatically.
The closure F⁺ is the set of all FDs implied by F. It is unique but huge (exponential in the number of attributes), so we test membership instead of listing it: X → Y ∈ F⁺ exactly when Y ⊆ X⁺ computed under F.
A set F covers a set G if every FD in G is in F⁺. F and G are equivalent (F ≡ G, F⁺ = G⁺) when each covers the other. Equivalent sets describe exactly the same constraints, so a designer can replace a messy F by a simpler equivalent set.
If even one FD of G fails the test under F, F does not cover G and the sets are not equivalent. The test always needs both directions: G = {A → B} is covered by F = {A → B, B → C}, but G does not cover F.
A minimal cover Fₘ of F is an equivalent set with no redundancy: (1) every right-hand side is a single attribute; (2) no left-hand side contains an extraneous attribute; (3) no FD is redundant (derivable from the others). Korth's canonical cover is the same idea with FDs of equal left side combined by the union rule. Minimal covers feed the 3NF synthesis algorithm in the next topic.
Some redundancy is invisible to FDs. Suppose emp_skill_lang(ename, skill, language) records that Divya has skills {SQL, Python} and speaks {Malayalam, English, Hindi}, with skills and languages independent. Every skill must be paired with every language, giving 2 × 3 = 6 rows, yet no non-trivial FD holds — the only key is all three attributes.
The constraint at work is a multivalued dependency ename →→ skill (and by complementation ename →→ language): the set of skills for an employee is independent of the languages. Every FD is also an MVD, but not conversely. MVDs drive fourth normal form, covered in the 4NF/5NF topic.
Try the problem first, then reveal the working one step at a time.
Relation r(A, B, C, D) holds the tuples (a1, b1, c1, d1), (a1, b1, c2, d2), (a2, b2, c1, d3), (a3, b2, c3, d3). Which of these FDs are violated: A → B, B → A, A → C, D → B, C → B, AC → D?
R(A, B, C, D, E, F, G) with F = {A → B, BC → DE, D → F, AEF → G}. Find (AC)⁺ and all candidate keys.
R(A, B, C, D, E, F, G, H) with F = {A → BC, CDE → F, F → A, EG → H}. Find all candidate keys and the prime attributes.
Find a minimal cover of F = {A → BC, B → C, AB → D, D → BE}.
R(A, B, C, D, E) with F = {A → BC, CD → E, B → D, E → A}. Find all candidate keys.
R(A, B, C, D, E, F) with F = {A → B, C → D, AD → E, E → F, BF → C}. Compute A⁺ and (AC)⁺, then list all candidate keys.
Using Armstrong's axioms prove pseudotransitivity (X → Y and WY → Z imply WX → Z). Then use it to derive AD → E from A → B, B → C and CD → E.
Are F = {A → B, AB → C, D → AC, D → E} and G = {A → BC, D → AE} equivalent? Show both directions.
Find a minimal cover of F = {AB → C, A → B, B → C, C → D}.
12 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.
Modelled on real KPSC questions (reworded) with the same concept and answer; each links to its original paper.