Functional dependencies and closure
Functional dependencies as constraints on a relation schema, trivial and non-trivial dependencies, Armstrong's axioms (reflexivity, augmentation, transitivity) and the derived rules, the closure of a set of attributes and the algorithm that computes it, testing whether a dependency is implied, equivalence of sets of dependencies, and why a set of dependencies can imply exponentially many others; the rules were checked against the semantic definition on all relations over small domains.
Why it exists
A key says that one set of attributes determines all the others. A functional dependency (FD) generalises this: one set of attributes determines some others, such as a course id determining the course title. FDs are the raw material of normalisation: they tell which facts are stored redundantly, which in turn causes anomalies. GATE asks for attribute closures, for implication between FDs, and for the keys and normal forms that follow (normal forms).
Prerequisites
You need relations, keys and the idea of legal instances (relational model and keys).
Precise definitions
Let be a relation schema with attribute sets . A relation instance satisfies the functional dependency if for any two tuples :
In words: tuples that agree on also agree on ; the value of determines the value of . A dependency of the schema is a constraint: it must hold in every legal instance. From an instance one can only refute an FD (two tuples that agree on and differ on ), never prove it.
- is trivial if (it holds in every relation). Otherwise it is non-trivial.
- says exactly that is a superkey: a key is a special case of an FD.
- For a set of FDs, the closure is the set of all FDs implied by : those that hold in every relation that satisfies . We write .
Armstrong's axioms (sound and complete for FDs):
- Reflexivity: if then .
- Augmentation: if then for any .
- Transitivity: if and then .
Sound means every FD derived this way really is implied; complete means every implied FD can be derived. Derived rules: union (, give ), decomposition ( gives and ), pseudotransitivity (, give ).
How it works
The closure of a set of attributes
The closure (with respect to ) is the set of all attributes with . It is computed by a simple loop:
- start with ;
- while some dependency of has and : add to the result;
- stop when nothing can be added.
Then exactly when . For with :
Computing attribute closures for R(A, B, C, D, E) with F = { A → B, BC → E, ED → A }: start
Computed by a script, not typed| step | dependency used | closure so far |
|---|---|---|
| X = AC: start | ||
| X = AC: after A → B | ||
| X = AC: after BC → E | ||
| X = AC: done | ||
| X = CD: start | ||
| X = CD: done | ||
| X = CDE: start | ||
| X = CDE: after DE → A | ||
| X = CDE: after A → B | ||
| X = CDE: done |
Step 0
The closure X+ is the set of all attributes that X determines. Repeat: if the left side of a dependency is inside the set, add its right side; stop when nothing changes. X → Y follows from F exactly when Y is inside X+.
: adds , then adds ; needs . So is implied, but is not a superkey. : nothing fires. : adds , adds , so is a superkey.
Why the loop is correct. Each attribute added is derived from by Armstrong's rules (soundness). Conversely, if , the relation with two tuples that agree exactly on and differ everywhere else satisfies (any dependency whose left side lies inside has its right side inside too) and violates : so is not implied (completeness). This construction was run by program: the closure agrees with semantic implication on all relations over a small domain.
Testing an FD and comparing sets of FDs
- Does imply ? Compute and check .
- Are two sets and equivalent ()? Check that every FD of is implied by and every FD of is implied by (compute closures with respect to the other set).
- Is a single FD redundant in ? Remove it and test whether it is still implied by the rest.
For example is equivalent to : the third dependency follows by transitivity.
How large can be
can be much larger than . From follows for every subset of : dependencies with left side alone (counted by program for ). That is why algorithms work with closures of attribute sets and with small covers, never with itself.
Dependencies in an instance
For the instance = {(1, x, p), (2, x, p), (3, y, q), (4, y, q)} the single-attribute FDs that hold are , , and (computed by testing each pair). and fail ( occurs with and ). Remember: that these hold in the instance does not make them constraints of the schema; the designer decides from the meaning of the data.
Worked examples
EX 1Closure
Easy, . ( then ). . , so is a superkey. because .
EX 2Is it implied
Easy. Does imply ? contains : yes. Does it imply ? : no.
EX 3Equivalent sets
Mediumand . From : so holds; is in . From : follows by decomposition; is in . They are equivalent.
EX 4Pseudotransitivity
Mediumand give : from augmented by we get , and with transitivity gives . The closure confirms: (by ), then .
EX 5Typical questions
GATE level(a) "Which of the following FDs is trivial?" One whose right side is a subset of the left side, e.g. . (b) "Given , how do you test whether holds?" Compute . (c) "Armstrong's axioms are:" sound and complete. (d) " and imply:" (union). (e) " implies:" and (decomposition); it does not imply or . (f) "If and hold, which holds:" .
Cheat box
Cheat box
- : tuples that agree on agree on . Trivial if . means is a superkey.
- Armstrong: reflexivity, augmentation, transitivity (sound and complete). Derived: union, decomposition, pseudotransitivity.
- Closure : add right sides of dependencies whose left sides are inside the set, until nothing changes. .
- Equivalence of and : each implies every dependency of the other.
- can be exponentially large; instances only refute FDs.
Traps and GATE patterns
Connections
Builds on
Across subjects
No cross-subject links yet.
Within this subject
Closures give the candidate keys (finding candidate keys), which in turn define the normal forms (normal forms); minimal covers are treated further on the page for decomposition (lossless join and dependency preservation).
PYQs
9 previous year questions from your book. I re-solved each one myself (8 by running or simulating, 1 by reasoning only); the book's key is shown next to my answer. All PYQs
In the context of schema normalization in relational DBMS, consider a set F of functional dependencies. The set of all functional dependencies implied by F is called the closure of F. To compute the closure of F, Armstrong's Axioms can be applied. Consider X, Y, and Z as sets of attributes over a relational schema. The three rules of Armstrong's axioms are described as follows. Reflexivity: If Y ⊆ X, then X → Y Augmentation: If X → Y, then XZ → YZ for any Z Transitivity: If X → Y and Y → Z, then X → Z The additional rule of Union is defined as follows. Union: If X → Y and X → Z, then X → YZ It can be proved that the additional rule of Union is also implied by the three rules of Armstrong's Axioms. Listed below are four combinations of these three rules. Which one of these combinations is both necessary and sufficient for the proof?
- (a)Reflexivity, Augmentation, and Transitivity
- (b)Reflexivity and Augmentation
- (c)Transitivity
- (d)Augmentation and Transitivity
Let P, Q, R and S be the attributes of a relation in a
relational schema. Let X → Y indicate functional
dependency in the context of a relational database, where
X, Y ⊆ {P, Q, R, S}.
Which of the following options is/are always true?- (a)If {P, Q} → {R} and {P} → {R}, then {Q} → {R}
- (b)If {P, Q} → {R}, then ({P} → {R} or {Q} → {R})
- (c)If {P} → {R} and {Q} → {S}, then {P, Q} → {R, S}
- (d)If {P} → {R}, then {P, Q} → {R}
The symbol → indicates functional dependency in the context of a relational database. Which of the following options is/are TRUE?
- (a)(X,Y)→(Z,W) implies X→(Z,W)
- (b)(X,Y)→(Z,W) implies (X,Y)→Z
- (c)((X,Y)→Z and W→Y) implies (X,W)→Z
- (d)(X→Y and Y→Z) implies X→Z
A functional dependency F: X→Y is termed as a useful fimctional dependency if and only if it satisfies all the following three conditions: X is not the empty set. Y is not the empty set. Intersection of X and Y is the empty set. For a relation R with 4 attributes, the total number of possible useful functional dependencies is ____
Suppose the following functional dependencies hold on a relation U with attributes P, Q R, S, and T: P → QR RS → T Which of the following functional dependencies can be inferred from the above functional dependencies?
- (a)PS → T
- (b)PS → Q
- (c)P → R
- (d)R → T
Consider the relation X(P, Q, R, S, T, U) with the
following set of functional dependencies
F = {{P, R} → {S, T}
{P, S, U} → {Q, R}}
Which of the following is the trivial functional
dependency in F+ is closure of F?- (a){P, R} → {S, T}
- (b){P, R} → {R, T}
- (c){P, S} → {S}
- (d){P, S, U} → {Q}
The following functional dependencies are given: AB → CD AF → D DE → F C → G F → E G → A Which one of the following options is false?
- (a){CF}+ = {ACDEFG}
- (b){BG}+ = {ABCDG}
- (c){AF}+ = {ACDEFG}
- (d){AB}+ = {ABCDG} DATABASE MANAGEMENT SYSTEM
In a schema with attributes A, B, C, D and E following set of functional dependencies are given A → B A → C CD → E B → D E → A Which of the following functional dependencies is NOT implied by the above set?
- (a)CD → AC
- (b)BD → CD
- (c)BC → CD
- (d)AC → BC
The following functional dependencies hold for relations R(A, B, C) and S(B, D, E): B -> A , A -> C The relation R contains 200 tuples and the relation S contains 100 tuples. What is the maximum number of tuples possible in the natural join of R and S (R ⋈S) ?
- (a)100
- (b)200
- (c)300
- (d)2000
Self-check
Question 1
, . Compute .
Show answerHide
: ; : ; : . , so is a key.
Question 2
Is equivalent to ?
Show answerHide
Yes: follows by transitivity, so adding it changes nothing.
Question 3
Why does the two-tuple relation agreeing on prove completeness?
Show answerHide
It satisfies every dependency of but violates for any , so such an is not implied.
Question 4
What is the closure of for ?
Show answerHide
: no dependency has a left side inside .
Revision card
One-screen revision
- FD: agree on agree on ; trivial if ; key = .
- Armstrong: reflexivity, augmentation, transitivity; union, decomposition, pseudotransitivity.
- by repeated firing; iff implied.
- Equivalence by mutual implication; may be exponential.
References
- ·Silberschatz, Korth, Sudarshan, Database System Concepts (7th edition), Chapter 7, Sections 7.2 and 7.4 (functional dependencies, theory of functional dependencies)
- ·Elmasri, Navathe, Fundamentals of Database Systems (7th edition), Chapter 14, Sections 14.2 and 14.3 (functional dependencies and inference rules)
Verification
scripts/enum-checks/db_fd_check.py: for random sets of dependencies over three attributes, 'Y is in the closure of X' was compared with the semantic definition of implication (every relation over the domain {0, 1}, all 256 of them, that satisfies F satisfies X -> Y) for every pair X, Y, and agrees; for four attributes the same was checked with the 136 relations of one or two tuples (a counterexample to an unimplied dependency is always a two-tuple relation) and, for soundness, on random relations that satisfy F; Armstrong's rules and the union and decomposition rules held on 300 random cases; the 2^m dependencies A -> Y implied by A -> B1, ..., A -> Bm were counted for m up to 5; the set of dependencies that hold in the small instance on this page was computed. The reasoning about which dependencies are constraints of the schema (not of an instance) is the textbook definition. Textbook chapter references are from memory. SECOND PASS (2026-11-02, done by the assistant, not a human check): every Self-check question was solved before the printed answer was read and all agreed; the definitions, worked examples, cheat box and traps were read claim by claim and re-derived against the textbook definitions and the sample database. No defect found. Status raised to self-checked; verified needs a textbook or human check.
last verified: never
My notes (saved in this browser)