Generally speaking, in any given model or equation, there are two types of variables:

- Independent variables - The values that can be changed in a given model or equation. They provide the "input" which is modified by the model to change the "output."
- Dependent variables - The values that result from the independent variables.

The definition of an independent or dependent variable is more-or-less universal in both statistical or scientific experiments and in mathematics; however, the way the variable is used varies slightly between experimental situations and mathematics.

If a scientist conducts an experiment to test the theory that a vitamin could extend a person’s life-expectancy, then:

- The independent variable is the amount of vitamin that is given to the subjects within the experiment. This is controlled by the experimenting scientist.

- The dependent variable, or the variable being affected by the independent variable, is life span.

The independent variables and dependent variables can vary from person to person, and the variances are what are being tested; that is, whether the people given the vitamin live longer than the people not given the vitamin. The scientist might then conduct further experiments changing other independent variables -- gender, ethnicity, overall health, etc. -- in order to evaluate the resulting dependent variables and to narrow down the effects of the vitamin on life span under difference circumstances.

Here are some other examples of dependent and independent variables in scientific experiments:

- A scientist studies the impact of a drug on cancer. The independent variables are the administration of the drug - the dosage and the timing. The dependent variable is the impact the drug has on cancer.
- A scientist studies the impact of withholding affection on rats. The independent variable is the amount of affection. The dependent variable is the reaction of the rats.
- A scientist studies how many days people can eat soup until they get sick. The independent variable is the number of days of consuming soup. The dependent variable is the onset of illness.

In mathematics, the "x" and "y" values in an equation or a graph are referred to as "variables."

- If an equation shows a relationship between x and y in which the value of y is dependent upon the value of x, y is known as the dependent variable and is sometimes referred to as ‘function(x)’ or f(x).
- The final solution of the equation, y, depends on the value of x, the independent variable which can be changed.

In both math and science, dependent and independent variables can be plotted on the x and y axes of a graph. There is typically a clear and obvious relationship between x and y shown on the graph.

An example of this would be Boyle’s Gas Law where the pressure of a gas is inversely proportional to its pressure as long as the temperature remains constant.

- Using the equation (y = kx), one can plot a graph that will yield a theoretical value for y when given any value for x, allowing one to accurately predict the affect the independent variable will have on the dependent variable.

In order to have come up with the equation for what is now Boyle’s Gas Law, Boyle himself would have had to conduct a series of experiments that measured the effect that altering the independent variable (temperature) had on the dependent variable (pressure). This would have put both independent and dependent variables into a real life, practical context. Boyle was then able to devise his equation based on his observations of the independent and dependent variables.