G27
Self-checkedTier 1 9 min readdbms.functional-dependencies

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 RR be a relation schema with attribute sets X,Y⊆RX, Y \subseteq R. A relation instance rr satisfies the functional dependency X→YX \to Y if for any two tuples t1,t2∈rt_1, t_2 \in r:

t1[X]=t2[X] ⟹ t1[Y]=t2[Y].t_1[X] = t_2[X] \ \Longrightarrow\ t_1[Y] = t_2[Y].

In words: tuples that agree on XX also agree on YY; the value of XX determines the value of YY. 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 XX and differ on YY), never prove it.

  • X→YX \to Y is trivial if Y⊆XY \subseteq X (it holds in every relation). Otherwise it is non-trivial.
  • X→RX \to R says exactly that XX is a superkey: a key is a special case of an FD.
  • For a set FF of FDs, the closure F+F^+ is the set of all FDs implied by FF: those that hold in every relation that satisfies FF. We write F⊨X→YF \models X \to Y.

Armstrong's axioms (sound and complete for FDs):

  1. Reflexivity: if Y⊆XY \subseteq X then X→YX \to Y.
  2. Augmentation: if X→YX \to Y then XZ→YZXZ \to YZ for any ZZ.
  3. Transitivity: if X→YX \to Y and Y→ZY \to Z then X→ZX \to Z.

Sound means every FD derived this way really is implied; complete means every implied FD can be derived. Derived rules: union (X→YX \to Y, X→ZX \to Z give X→YZX \to YZ), decomposition (X→YZX \to YZ gives X→YX \to Y and X→ZX \to Z), pseudotransitivity (X→YX \to Y, WY→ZWY \to Z give WX→ZWX \to Z).

How it works

The closure of a set of attributes

The closure X+X^+ (with respect to FF) is the set of all attributes AA with F⊨X→AF \models X \to A. It is computed by a simple loop:

  1. start with result=X\text{result} = X;
  2. while some dependency L→ML \to M of FF has L⊆resultL \subseteq \text{result} and M⊈resultM \not\subseteq \text{result}: add MM to the result;
  3. stop when nothing can be added.

Then F⊨X→YF \models X \to Y exactly when Y⊆X+Y \subseteq X^+. For R(A,B,C,D,E)R(A, B, C, D, E) with F={A→B, BC→E, DE→A}F = \{A \to B,\ BC \to E,\ DE \to A\}:

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
stepdependency usedclosure 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+.

0 / 10
computed by script: dependencies, closures, keys and decompositions are computed by scripts/db_fd.py. python3 scripts/gen-db3-traces.py

AC+=ABCEAC^+ = ABCE: A→BA \to B adds BB, then BC→EBC \to E adds EE; DE→ADE \to A needs DD. So AC→BEAC \to BE is implied, but ACAC is not a superkey. CD+=CDCD^+ = CD: nothing fires. CDE+=ABCDECDE^+ = ABCDE: DE→ADE \to A adds AA, A→BA \to B adds BB, so CDECDE is a superkey.

Why the loop is correct. Each attribute added is derived from XX by Armstrong's rules (soundness). Conversely, if A∉X+A \notin X^+, the relation with two tuples that agree exactly on X+X^+ and differ everywhere else satisfies FF (any dependency whose left side lies inside X+X^+ has its right side inside X+X^+ too) and violates X→AX \to A: so AA 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 FF imply X→YX \to Y? Compute X+X^+ and check Y⊆X+Y \subseteq X^+.
  • Are two sets FF and GG equivalent (F+=G+F^+ = G^+)? Check that every FD of FF is implied by GG and every FD of GG is implied by FF (compute closures with respect to the other set).
  • Is a single FD redundant in FF? Remove it and test whether it is still implied by the rest.

For example {A→B, B→C, A→C}\{A \to B,\ B \to C,\ A \to C\} is equivalent to {A→B, B→C}\{A \to B,\ B \to C\}: the third dependency follows by transitivity.

How large can F+F^+ be

F+F^+ can be much larger than FF. From F={A→B1,A→B2,…,A→Bm}F = \{A \to B_1, A \to B_2, \ldots, A \to B_m\} follows A→YA \to Y for every subset YY of {B1,…,Bm}\{B_1, \ldots, B_m\}: 2m2^m dependencies with left side AA alone (counted by program for m≤5m \le 5). That is why algorithms work with closures of attribute sets and with small covers, never with F+F^+ itself.

Dependencies in an instance

For the instance R(A,B,C)R(A, B, C) = {(1, x, p), (2, x, p), (3, y, q), (4, y, q)} the single-attribute FDs that hold are A→BA \to B, A→CA \to C, B→CB \to C and C→BC \to B (computed by testing each pair). B→AB \to A and C→AC \to A fail (B=xB = x occurs with A=1A = 1 and A=2A = 2). 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

R(A,B,C,D)R(A, B, C, D), F={A→B, B→C}F = \{A \to B,\ B \to C\}. A+=ABCA^+ = ABC (A→BA \to B then B→CB \to C). D+=DD^+ = D. AD+=ABCDAD^+ = ABCD, so ADAD is a superkey. F⊨A→CF \models A \to C because C∈A+C \in A^+.

EX 2Is it implied

Easy

F={AB→C, C→D}F = \{AB \to C,\ C \to D\}. Does FF imply AB→DAB \to D? AB+=ABCDAB^+ = ABCD contains DD: yes. Does it imply A→CA \to C? A+=AA^+ = A: no.

EX 3Equivalent sets

Medium

F={A→BC, B→C}F = \{A \to BC,\ B \to C\} and G={A→B, B→C}G = \{A \to B,\ B \to C\}. From GG: A+=ABCA^+ = ABC so A→BCA \to BC holds; B→CB \to C is in GG. From FF: A→BA \to B follows by decomposition; B→CB \to C is in FF. They are equivalent.

EX 4Pseudotransitivity

Medium

A→BA \to B and BC→DBC \to D give AC→DAC \to D: from A→BA \to B augmented by CC we get AC→BCAC \to BC, and with BC→DBC \to D transitivity gives AC→DAC \to D. The closure confirms: AC+∋BAC^+ \ni B (by A→BA \to B), then DD.

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. AB→AAB \to A. (b) "Given FF, how do you test whether X→YX \to Y holds?" Compute X+X^+. (c) "Armstrong's axioms are:" sound and complete. (d) "X→YX \to Y and X→ZX \to Z imply:" X→YZX \to YZ (union). (e) "X→YZX \to YZ implies:" X→YX \to Y and X→ZX \to Z (decomposition); it does not imply Y→ZY \to Z or Y→XY \to X. (f) "If A→BA \to B and B→CB \to C hold, which holds:" A→CA \to C.

Cheat box

Cheat box

  • X→YX \to Y: tuples that agree on XX agree on YY. Trivial if Y⊆XY \subseteq X. X→RX \to R means XX is a superkey.
  • Armstrong: reflexivity, augmentation, transitivity (sound and complete). Derived: union, decomposition, pseudotransitivity.
  • Closure X+X^+: add right sides of dependencies whose left sides are inside the set, until nothing changes. F⊨X→Y  ⟺  Y⊆X+F \models X \to Y \iff Y \subseteq X^+.
  • Equivalence of FF and GG: each implies every dependency of the other.
  • F+F^+ can be exponentially large; instances only refute FDs.

Traps and GATE patterns

Connections

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

GATE 2026 · Set 2 · MCQ · 2 marksQ1 · page 369 of the book
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
GATE 2026 · Set 1 · MSQQ2 · page 369 of the book
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}
GATE 2024 · Set 1 · MSQ · 2 marksQ8 · page 370 of the book
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
GATE 2024 · Set 2 · NAT · 2 marksQ9 · page 370 of the book
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 ____
GATE 2021 · Set 2 · MSQ · 2 marksQ13 · page 370 of the book
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
GATE 2015 · Set 3 · MCQ · 1 markQ22 · page 372 of the book
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}
GATE 2006 · MCQ · 2 marksQ36 · page 374 of the book
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
year not read yetQ41 · page 375 of the book
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
GATE 2010 · MCQ · 2 marksQ20 · page 392 of the book
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

R(A,B,C,D)R(A, B, C, D), F={A→B, C→D, B→C}F = \{A \to B,\ C \to D,\ B \to C\}. Compute A+A^+.

Show answer

A→BA \to B: ABAB; B→CB \to C: ABCABC; C→DC \to D: ABCDABCD. A+=ABCDA^+ = ABCD, so AA is a key.

Question 2

Is {A→B, B→C}\{A \to B,\ B \to C\} equivalent to {A→B, B→C, A→C}\{A \to B,\ B \to C,\ A \to C\}?

Show answer

Yes: A→CA \to C follows by transitivity, so adding it changes nothing.

Question 3

Why does the two-tuple relation agreeing on X+X^+ prove completeness?

Show answer

It satisfies every dependency of FF but violates X→AX \to A for any A∉X+A \notin X^+, so such an AA is not implied.

Question 4

What is the closure of {B}\{B\} for F={A→B}F = \{A \to B\}?

Show answer

B+=BB^+ = B: no dependency has a left side inside {B}\{B\}.

Revision card

One-screen revision

  • FD: agree on XX ⇒\Rightarrow agree on YY; trivial if Y⊆XY \subseteq X; key = X→RX \to R.
  • Armstrong: reflexivity, augmentation, transitivity; union, decomposition, pseudotransitivity.
  • X+X^+ by repeated firing; Y⊆X+Y \subseteq X^+ iff implied.
  • Equivalence by mutual implication; F+F^+ 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