# Easiest way to find the closure set of attribute

• Difficulty Level : Basic
• Last Updated : 16 Oct, 2020

Set of all those attributes which can be functionally determined from an attribute set is called closure of the attribute set and the closure of the attribute set {X} is denoted as {X}+. We can only find candidate key and primary keys only with help of closure set of an attribute.

So let see the easiest way to calculate the closure set of attributes. In this method you have to do the multiple iteration.

Example-1 :
Let R(A, B, C) is a table which has three attributes A, B, C.

also their is two functional decencies :

```A–>B
B–>C
```

So the,

`(A)+ = {A, B, C} `

This is because we can find B with A and when we get B we can also find the C. In this the property of transitivity is used.

Example-2 :
Let take table R(A, B, C, D, E, F, G). Functional dependencies are :

```A–>B
BC–>DE
AEG—>G
```

So you have to find the closure of (AC)+ .

So see the above dependencies. You can see (AC) is already exits and A is already present so by using the above dependencies you can find B with the help of A then you have (ABC) in you set now you also have BC in your set so you can find DE using the above dependencies(see the dependency no.2). Now you have (ABCDE) in your but see you don’t have G in your set so you cannot find G using (AEG) dependency.

So the closure of the (AC) is (ABCDE). And this mean if you have AC you can find (ABCDE).

Example-3 :
Let take another table R(A, B, C, D, E). Functional dependencies :

```A–>BC
CD–>E
B—> D
E—>A
```

So you have to find the closure of (B)+ .

Now you have already B in your set. Through B you can find the D (see dependency B–>D) now you have (BD). You can see that after iterating and checking we can’t find any dependency through (BD). So the closure of B is BD.

My Personal Notes arrow_drop_up