In our daily life, we must have experienced situations dealing with the  comparison of two variables.
For example, when the side of the square increases, the area of the square also increases.
Similarly, when we decide to buy books, the amount we pay depends on the number of books purchased.
When we observe both the discussed situations carefully, we might find both the situations dealing with two variables. Out of the two variables, one is an independent variable, and the other is a dependent variable. We can use a graph to demonstrate the relationship between these two variables.
Independent variable: An independent variable does get affected by the other variable. It can take the values freely.
Dependent variable: The value of the dependent variable depends upon the independent variable.
In the situations discussed earlier, let us find the independent and dependent variables.
1. The area of the square depends upon the varying lengths of its side. Hence, the square's side is the independent variable, and the square's area is the dependent variable.
2. The increase in the final amount depends upon the number of books bought. Therefore, the number of books purchased is the independent variable, and the final bill amount is the dependent variable.