VOOZH about

URL: https://www.geeksforgeeks.org/maths/degrees-of-freedom/

⇱ Degrees of Freedom - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Degrees of Freedom

Last Updated : 25 May, 2026

Degrees of Freedom (DOF) are the number of independent values in a data set that are free to vary while satisfying a given condition or constraint.

  • It represents the amount of independent information available for statistical analysis.
  • It is usually calculated using the following formula:
πŸ‘ DOF

The following points help to understand Degrees of Freedom more easily:

πŸ‘ degrees_of_freedom
  • Degrees of freedom represent the number of choices available in a data set before a restriction is applied.
  • For example, if there are four options and one option must be chosen, the degree of freedom is 3 because the final choice becomes fixed after the others are considered.
  • Degrees of freedom are widely used in statistical tests such as t-tests, chi-square tests, and F-tests.

Example: Total Marks Constraint

Suppose five students together scored a total of 250 marks.

You can freely choose the marks of the first four students. For example, their marks may be:

40, 55, 60, and 45

After choosing these four values, the marks of the fifth student are automatically fixed. To make the total equal to 250, the fifth student must score 50 marks.

This means:

  • The first four values can vary freely.
  • The fifth value depends on the other four values and cannot vary independently.

Therefore, only four values are independent.

Degrees of Freedom (DOF) = 5 βˆ’ 1 = 4.

Degrees of freedom and hypothesis testing

Degrees of freedom help determine the critical value used in hypothesis testing. Different values of degrees of freedom change the shape of probability distributions such as the t-distribution and chi-square distribution.

Student’s t-Distribution

In a t-test, the calculated t-value is compared with a critical value from the Student’s t-distribution. The shape of this distribution depends on the degrees of freedom.

πŸ‘ t
  • Small degrees of freedom (df) produce wider distributions with heavier tails.
  • As the degrees of freedom (df) increase, the distribution becomes narrower and closer to the standard normal distribution.
  • For df β‰₯ 30, the t-distribution is nearly the same as the standard normal distribution.

Chi-Square Distribution

In a chi-square test, the calculated chi-square value is compared with a critical value from the chi-square distribution. The shape of this distribution also depends on the degrees of freedom (df).

πŸ‘ degrees_of_freedom3
  • When df < 3, the distribution has a backward β€œJ” shape.
  • When df β‰₯ 3, the distribution becomes hump-shaped and right-skewed.
  • As the degrees of freedom (df) increase, the distribution becomes more similar to a normal distribution.

The following table shows the formulas used to calculate Degrees of Freedom for some commonly used statistical tests:

TestFormulaNotes
One-sample t-testdf = n βˆ’ 1n represents the total number of observations in the sample
Independent samples t-testdf = n₁ + nβ‚‚ βˆ’ 2n₁ and nβ‚‚ represent the sample sizes of the two groups
Dependent samples t-testdf = n βˆ’ 1n represents the total number of paired observations
Simple linear regressiondf = n βˆ’ 2Two degrees of freedom are used for estimating the regression parameters
Chi-square goodness of fit testdf = k βˆ’ 1k represents the total number of categories or groups
Chi-square test of independencedf = (r βˆ’ 1) Γ— (c βˆ’ 1)r represents the number of rows and c represents the number of columns in the contingency table
One-way ANOVABetween-group df = k βˆ’ 1 Within-group df = N βˆ’ k Total df = N βˆ’ 1k represents the number of groups, and N represents the total number of observations

Degrees of Freedom in Mechanics

In mechanics, Degrees of Freedom (DOF) describe the number of independent directions in which an object can move. A moving object can have different types of motion,n such as left-right, up-down, and forward-backwards movement. Each independent movement represents one degree of freedom.

  • If an object can move only left and right, it has 1 degree of freedom.
  • If it can move left-right and up-down, it has 2 degrees of freedom.
  • If it can also move forward and backwards, it has 3 degrees of freedom.

Therefore, an object moving freely in three-dimensional space has three degrees of freedom.

πŸ‘ degrees_of_freedom1

For example, a helicopter moving through space can move:

  • Left and right
  • Up and down
  • Forward and backward

So, it has 3 degrees of freedom for motion.

On the other hand, an elevator can move only up and down because it is restricted by the elevator shaft. Therefore, it has only 1 degree of freedom.

If there are two elevators moving independently, the system has 2 degrees of freedom because each elevator can move separately.

Solved Examples

Example 1: Determine the degrees of Freedom for the given set of data.

Data: 5, 7, 4, 6, 10, 12

Solution: 

Number of Values, n = 6

Degree of Freedom = n-1 

= 6 - 1

= 5

Example 2: Evaluate the Degree of Freedom for the given set of observations.

Observations: 1, 7, 5, 12, 17, 18, 19, 25

Solution: 

Number of Values, n = 8

Degree of Freedom = n - 1 

= 8 - 1

= 7

Example 3: Evaluate the degrees of Freedom for the given set of observations.

Observation 1: 1, 7, 5, 12, 17, 18, 19, 25

Observation 2: 14, 15, 21, 29, 10

Solution: 

  • Number of Values in Observation 1, n1 = 8
  • Number of Values in Observation 2, n2 = 5

Degree of Freedom = n1 + n2 - 2 

= 8 + 5 - 2 

= 11

Example 4: Evaluate the Degree of Freedom for the given set of observations.

Observation 1: 1, 6, 5, 13, 17

Observation 2: 12, 11, 26

Solution: 

  • Number of values in observation 1, n1 = 5
  • Number of values in observation 2, n2 = 3

Degree of Freedom = n1 + n2 - 2 

= 5 + 3 - 2 

= 6

Related Articles

Comment

Explore