What are degrees of freedom?
By Jude Wallis · Updated
Degrees of freedom count how many values in your data are still free to vary once the quantities you estimated from the data have pinned the rest down. Estimate one thing, such as the mean, and you lose one: $df = n - 1$. A two-way chi-square table loses more, leaving $(r-1)(c-1)$.
AP Statistics: Unit 4 (topics 4.5 Carrying Out a Test for a Population Mean or Population Mean Difference, 4.2 Constructing a Confidence Interval for a Population Mean or Population Mean Difference, 3.15 Carrying Out a Chi-Square Test for Homogeneity or Independence). The Fall 2026 AP Statistics course uses degrees of freedom of n - 1 for one-sample and paired t procedures in Unit 4, (rows - 1)(columns - 1) for the chi-square test for homogeneity or independence in Unit 3, and a technology-computed value between the smaller of n1 - 1 and n2 - 1 and n1 + n2 - 2 for two-sample t procedures.
The intuition: how many values are still free
Degrees of freedom, written , answer a counting question. You start with data values, all free to be anything. Then you compute something from them, and that computed value locks in a relationship the data now have to satisfy. Every relationship you impose costs you one free value.
Picture five test scores whose mean you have already calculated as 12. The first four scores can still be anything: 9, 14, 10, 15 are all allowed. But the fifth is no longer free. The five scores must total , and the first four total 48, so the fifth is forced to be 12. Four values were free, one was determined, so .
That is the whole idea. is the number of independent pieces of information left in the data after you have spent some of them on estimates. Because it counts how much information is available, it also controls how much the resulting statistic bounces around, which is why it selects a curve rather than just labeling one.
Why the sample standard deviation divides by n - 1
The sample standard deviation is built from deviations around the sample mean:
Here (x-bar) is the sample mean. Those deviations carry only independent pieces of information, because they always sum to exactly zero. Learn any of them and the last one is fixed. In the five-score example the deviations are , and the fifth had to be 0 once the first four were known.
So dividing the sum of squares by would be dividing by more pieces of information than you have. It also produces an estimate that is too small on average, since the deviations are measured around , the one center that makes the sum of squares as small as it can possibly be. Dividing by corrects both problems at once and makes an unbiased estimator of the population variance (sigma-squared).
If you knew the population mean (mu) and measured deviations around it instead, you would divide by , because nothing was estimated from the data. The full argument is in why you divide by n - 1.
Why a one-sample t test uses n - 1
The one-sample t statistic is
where (mu-nought) is the hypothesized mean, and the comes straight from the in the denominator. Since carries independent deviations, the t curve you compare against is the one indexed by . A sample of 25 gives , no matter what the numbers are.
The curve matters because is an estimate. A z-score has a fixed number in its denominator, so it varies only through the numerator. A t statistic has an estimate in the denominator too, and a denominator that happens to come out small makes large all on its own. That extra source of variation is what fattens the tails of the t distribution.
How fat depends on . Few degrees of freedom mean is unreliable and the tails are heavy; many degrees of freedom mean is close to and the tails thin out. The same applies to a paired t procedure, where is the number of pairs, since you compute one standard deviation from one column of differences. See the one-sample t-test walkthrough and when to use a paired t-test.
Why a two-way chi-square test uses (r - 1)(c - 1)
For a chi-square test of independence or homogeneity on a table with rows and columns, the degrees of freedom are
The same counting argument produces it. The expected counts are built from the row totals and the column totals, so those totals are treated as fixed. Ask how many cells you can fill in freely before the rest are forced.
Take a 2 by 3 table with row totals 60 and 40, column totals 50, 30, and 20, and grand total 100. Put 25 in the first cell and 20 in the second. The third cell of row 1 is now forced to . Row 2 is forced cell by cell from the column totals: , , and , which sum to 40 as required. Two cells were free, and .
In general you can fill the first rows and the first columns freely, a block of cells, and the margins determine everything else. A 3 by 4 table gives . Notice that here depends only on the shape of the table, never on the sample size, which is the opposite of the t case. The procedure itself is in chi-square tests explained.
A chi-square goodness-of-fit test on categories uses by the same logic, since the counts have to add to the sample total. That test was removed from the AP exam in the Fall 2026 redesign, but it is still standard college content.
Why a two-sample t gives a decimal, and why that is not a count
A two-sample t procedure for a difference of means breaks the pattern. Its standard error is
and it pools nothing: each group estimates its own spread. The exact distribution of the resulting statistic is not a t distribution at all. The Welch-Satterthwaite formula finds the t curve that comes closest, and the it returns is a tuning value for that curve, not a count of anything.
Because it is a tuning value, it has no reason to be a whole number. With , , , and , the two variance terms are and , and the formula returns . That is a real t curve, since the t density is defined for any positive .
Be honest about the difference. Every other on this page is an exact count of free values, and it is exactly right. The Welch value is an approximation chosen to make the p-value close to correct, not a count of anything. It does obey a window, , so the example's 11.88 sits between 8 and 19 as it must. That window is a quick check on your data entry, and the details are in why df is a decimal on a two-sample t-test.
How t approaches z as df grows
The clearest way to feel what does is to watch the two-sided 0.05 critical value (t-star) shrink as climbs. Every row below is the same tail area, read from the t-table, and the last row is the standard normal value (z-star).
| df | for two-sided 0.05 |
|---|---|
| 1 | 12.706 |
| 2 | 4.303 |
| 5 | 2.571 |
| 10 | 2.228 |
| 24 | 2.064 |
| 30 | 2.042 |
| 100 | 1.984 |
| (z) | 1.960 |
The collapse is dramatic at the start and slow at the end. Going from to drops by more than 10 points, while going from to shaves off only 0.058. By the gap to 1.960 is about 0.024, roughly 1.2%.
Read the pattern through the estimate. At you have a single independent deviation informing , so can land far from and the interval has to be enormous to keep its promised coverage. At , is a steady stand-in for and t behaves almost like z. The two never actually meet, which is why t stays the correct choice for a mean at any sample size.
Every df rule in this course, in one table
| Procedure | Degrees of freedom | Why |
|---|---|---|
| Sample standard deviation | Deviations around sum to 0 | |
| One-sample t for a mean | Comes from the in the denominator | |
| Paired t on differences | One standard deviation from one column of differences | |
| Two-sample t for two means | Welch value, usually a decimal | Approximation, not a count |
| Chi-square, two-way table | Row and column totals fix the rest | |
| Chi-square goodness of fit | Counts must total . Removed from the AP exam in the Fall 2026 redesign, still standard college content |
Two habits keep you out of trouble. Write the next to every test statistic you report, because means different things at and . And if a table forces you onto a whole-number row, round the down, never up, which keeps the tails heavier and the p-value slightly larger rather than smaller than the truth.
Count the free values in a sample of five
Five scores have a sample mean of . Four of them are 9, 14, 10, and 15. Show that the fifth value is determined, compute the sample standard deviation, and state the degrees of freedom.
The five values must total , because the mean is the total divided by 5.
The four known values total .
The fifth value is forced: . Four values were free, one was determined.
Deviations from the mean: , , , , . They sum to , as deviations around always do.
Squared deviations: , and their sum is .
Sample variance: .
Sample standard deviation: .
Degrees of freedom: , matching the four free values from step 3.
Compare the wrong divisor: dividing by would give and , an underestimate of the population spread.
The fifth value must be 12. The sample standard deviation is with . The count of free values and the divisor in are the same number, which is the reason appears in both places.
Find the df for four different procedures
State the degrees of freedom for each. (a) A one-sample t-test on 18 randomly selected battery lifetimes. (b) A paired t-test on 12 field samples split between two labs. (c) A chi-square test of independence on a 3 by 4 two-way table. (d) A two-sample t-test with , , , and .
(a) One sample, one estimated standard deviation: .
(b) Paired data collapse to 12 differences, so is the number of pairs: . Using 24 measurements here would be wrong.
(c) A two-way table depends only on its shape: . The sample size does not enter.
(d) Two-sample, so use Welch. Group 1 term: . Group 2 term: .
(d) Numerator: square the sum, .
(d) Denominator: .
(d) Divide: .
(d) Check the window: the smaller of and is 8, and . Since , the value is legitimate.
(a) . (b) . (c) . (d) . The first three are exact counts of free values; only the fourth is an approximation, and it is the only one that comes out as a decimal.
Frequently asked questions
Is df the same as the sample size?
No, and treating it that way shrinks your p-value below its true value. A sample of 25 gives for a one-sample t procedure. The gap is the price of estimating the mean from the same data you are using to estimate the spread.
Why does a chi-square df ignore the sample size?
Because the expected counts are built from the row and column totals, which are treated as fixed. Once those margins are set, only cells can be chosen freely, and that count depends on the shape of the table. A 2 by 3 table has whether the grand total is 100 or 10,000.
Can degrees of freedom be a decimal?
Only for the two-sample t procedure, where the Welch-Satterthwaite value is an approximation rather than a count. A t curve is defined for any positive , so software computes a p-value from 11.88 directly. Everywhere else in this course the is a whole number.
Do I round a decimal df up or down?
Down, if a table forces you onto a whole-number row. Rounding down keeps the tails a little heavier and the p-value a little larger, which errs toward caution. Rounding up thins the tails and reports a p-value smaller than the true one, which overstates your evidence.
At what df does t become z?
It never quite does. The two-sided 0.05 value falls from 2.228 at to 2.064 at to 1.984 at , approaching 1.960 but never reaching it. The difference stops mattering in practice well before then, though the t procedure stays valid at every sample size.