Chi-Square Distribution Visualizer
Chi-square PDF with df=5
Probability Results
Distribution Properties
Must be ≥ 0
Positive integer (or real > 0)
How Degrees of Freedom Change the Chi-Square Distribution
Every property of the chi-square distribution is a direct function of k, the degrees of freedom. Drag the slider above and you will see this directly: as k grows, the curve shifts right, the peak moves away from zero, and the heavy right skew gradually flattens.
| df (k) | Mean | Variance | Mode | Skewness | General shape |
|---|---|---|---|---|---|
| 1 | 1 | 2 | 0 | 2.828 | Extremely right-skewed; pole at zero |
| 2 | 2 | 4 | 0 | 2.000 | Exponential-shaped decay from zero |
| 3 | 3 | 6 | 1 | 1.633 | Right-skewed; peak above zero |
| 5 | 5 | 10 | 3 | 1.265 | Moderately right-skewed |
| 10 | 10 | 20 | 8 | 0.894 | Less skewed; clear unimodal peak |
| 20 | 20 | 40 | 18 | 0.632 | Noticeably more symmetric |
| 30 | 30 | 60 | 28 | 0.516 | Approximately bell-shaped |
| 50 | 50 | 100 | 48 | 0.400 | Nearly symmetric; still bounded at 0 |
For large k, the chi-square distribution can be approximated by a normal distribution with mean k and variance 2k: X ≈ N(k, 2k). The standardized form Z ≈ (X − k) / √(2k) approaches the standard normal. This approximation is useful in practice but the chi-square distribution remains bounded below by zero — unlike the normal, which extends across the entire real line.
The Mathematics Behind the Chi-Square Distribution
The chi-square distribution with k degrees of freedom has the following probability density function, defined for x ≥ 0:
The Gamma function Γ(k/2) appears here as the normalizing constant. For positive integer k, when k is even, Γ(k/2) = (k/2 − 1)!. When k is odd, the gamma function takes non-integer values. The calculator above computes all results using a numerically stable series expansion of the regularized incomplete gamma function, so tail probabilities remain accurate even at extreme values.
Why Chi-Square Values Cannot Be Negative
The chi-square variable is constructed by summing squared quantities: χ²ₖ = Z₁² + Z₂² + ... + Zₖ². Squaring any real number produces a non-negative result. The sum of non-negative values is also non-negative. This is why the left boundary of every chi-square distribution is exactly zero — and why the x-axis in the visualizer above never shows values below zero.
This also explains the right skew. At low degrees of freedom, most of the probability mass sits near zero, with a long tail extending right. As you add more squared normal components, the distribution spreads out, its peak moves right, and the heavy tail becomes proportionally smaller.
Connection to the Gamma Distribution
The chi-square distribution with k degrees of freedom is a special case of the Gamma distribution: χ²ₖ ~ Gamma(shape = k/2, scale = 2). This relationship is useful in mathematical statistics and provides a general framework for the chi-square's properties. For most applied work involving p-values and critical values, the chi-square form is the one you will encounter directly.
Where the Chi-Square Distribution Is Used
Several distinct statistical tests produce a chi-square statistic and use this distribution to find p-values. Each test has its own degrees-of-freedom formula and slightly different assumptions.
Each estimated parameter reduces df by one additional degree. Oᵢ = observed count in category i; Eᵢ = expected count under the null model. A large χ² statistic indicates that observed counts differ substantially from expected counts.
Observed cell counts are compared to expected counts under the assumption of independence. A large χ² statistic suggests the two variables are not independent in the population.
The computation proceeds the same way as an independence test, but the research question is different: you are asking whether categorical proportions are homogeneous across groups, rather than whether two variables within one population are associated.
This application carries a stronger distributional assumption than categorical chi-square tests: the individual data values must be approximately normally distributed. Here s² is the sample variance and n is the sample size.
p-Value vs Critical Value Approach
Both methods answer the same question — reject H₀ or not — and produce identical conclusions when applied correctly.
| Method | Decision rule | What you need |
|---|---|---|
| p-value approach | Reject H₀ if p ≤ α | χ² statistic, df, chosen α |
| Critical value approach | Reject H₀ if χ²_obs > χ²_critical (upper tail) | df, chosen α — look up table or calculate |
Chi-Square Critical Value Table
The values below are upper-tail critical values: P(X ≥ χ²_critical) = α. Use the interactive visualizer above for df values beyond 30 or for significance levels not listed here. See the full chi-square critical value table for an extended reference.
| df | α = 0.10 | α = 0.05 | α = 0.01 | α = 0.001 |
|---|---|---|---|---|
| 1 | 2.706 | 3.841 | 6.635 | 10.828 |
| 2 | 4.605 | 5.991 | 9.210 | 13.816 |
| 3 | 6.251 | 7.815 | 11.345 | 16.266 |
| 4 | 7.779 | 9.488 | 13.277 | 18.467 |
| 5 | 9.236 | 11.070 | 15.086 | 20.515 |
| 6 | 10.645 | 12.592 | 16.812 | 22.458 |
| 7 | 12.017 | 14.067 | 18.475 | 24.322 |
| 8 | 13.362 | 15.507 | 20.090 | 26.124 |
| 9 | 14.684 | 16.919 | 21.666 | 27.877 |
| 10 | 15.987 | 18.307 | 23.209 | 29.588 |
| 12 | 18.549 | 21.026 | 26.217 | 32.909 |
| 15 | 22.307 | 24.996 | 30.578 | 37.697 |
| 20 | 28.412 | 31.410 | 37.566 | 45.315 |
| 25 | 34.382 | 37.652 | 44.314 | 52.620 |
| 30 | 40.256 | 43.773 | 50.892 | 59.703 |
All values are upper-tail critical values verified against the regularized incomplete gamma function. For additional df and α values, use the visualizer's Critical Value tab above or visit the chi-square table.
Worked Examples
Example 1: Goodness-of-Fit Test
A researcher expects four product categories to attract equal customer interest. Observed counts from a survey of 200 customers: Category A = 60, B = 45, C = 55, D = 40.
Example 2: Test of Independence (2 × 3 Table)
A researcher tests whether preference (Low, Medium, High) is independent of customer type (Existing, New). Observed counts: Existing: 30, 50, 20; New: 20, 40, 40.
Example 3: Critical Value at df=5, α=0.05
Chi-Square vs Other Distributions
| Property | Chi-square (χ²) | t-distribution | F-distribution |
|---|---|---|---|
| Support | x ≥ 0 | All real numbers | x ≥ 0 |
| Parameters | df = k | df = ν | df₁, df₂ |
| Shape at low df | Right-skewed | Symmetric, heavy tails | Right-skewed |
| Bounded below? | Yes — at zero | No | Yes — at zero |
| Can take negative values? | No | Yes | No |
| Mean | k | 0 (ν > 1) | df₂/(df₂−2) (df₂ > 2) |
| Common uses | Categorical tests, variance | Mean comparisons | Variance ratios, ANOVA |
| Relationship | χ²(k) = sum of k squared normals | Normal / √(χ²/k) | χ²(d₁)/d₁ ÷ χ²(d₂)/d₂ |
When Is a Chi-Square Test Appropriate?
The chi-square approximation works best when expected cell counts are reasonably large. Many textbooks use a rule of thumb that expected counts should be at least 5 in each cell, though this is a practical guideline rather than an absolute requirement. The appropriateness of the approximation depends on the table structure, the overall sample size, and the specific test.
When expected counts are very small — particularly in sparse contingency tables — Fisher's exact test is often more appropriate. Fisher's exact test does not rely on a large-sample approximation and is exact for 2×2 tables regardless of cell counts.
Common Chi-Square Distribution Mistakes
- Assuming chi-square values can be negative. They cannot. The distribution is bounded below by zero.
- Confusing df with sample size. Degrees of freedom depend on the test structure, not directly on n.
- Using the wrong tail. Most chi-square tests use the upper tail (larger statistics → more evidence against H₀).
- Confusing p-value with α. The p-value is calculated from your data; α is a threshold set before seeing the data.
- Assuming df = number of categories. For goodness of fit it is C−1, not C.
- Forgetting estimated parameters reduce df. Each parameter estimated from the data removes one degree of freedom.
- Claiming large df makes the distribution exactly normal. It becomes approximately normal in shape, but it remains bounded at zero.
- Ignoring expected count assumptions. Very small expected counts can make the chi-square approximation unreliable.
Frequently Asked Questions
A chi-square distribution is a continuous probability distribution that takes only non-negative values. It is parameterized entirely by its degrees of freedom k. Mathematically, a chi-square variable with k degrees of freedom equals the sum of k squared independent standard normal variables: χ²ₖ = Z₁² + Z₂² + ... + Zₖ². It is commonly used in hypothesis tests involving categorical data, variances, and goodness-of-fit assessments.
Squaring standard normal variables produces values that cluster near zero (because small values are common in a standard normal) while allowing occasional large values when the normals take large positive or negative values. The sum of a few squared normals still produces a distribution with more probability near zero than far from it, creating a right skew. As more squared normals are added (higher df), the skew decreases because the central limit effect begins to apply to the sum.
No. Chi-square values are always zero or positive. The distribution is the sum of squared quantities, and squaring any real number — positive, negative, or zero — produces a non-negative result. The left boundary of the chi-square distribution is exactly zero. A chi-square statistic of zero would mean every observed count exactly equals its expected count.
For an R × C contingency table, the degrees of freedom are df = (R − 1)(C − 1), where R is the number of rows and C is the number of columns. For a 2×2 table: df = 1. For a 2×3 table: df = 2. For a 3×4 table: df = 6. This formula comes from the number of free parameters in the table after the marginal totals are fixed.
The upper-tail probability P(X ≥ χ²_observed) is the probability of obtaining a chi-square statistic at least as large as the observed value, assuming the null hypothesis is true. This is the p-value for most standard chi-square tests (goodness-of-fit, independence, homogeneity). Larger observed statistics produce smaller p-values, which represent stronger evidence against H₀.
As degrees of freedom increase, the shape becomes increasingly symmetric and bell-like, approaching a normal distribution with mean k and variance 2k. A practical rule of thumb often cited in textbooks is that the normal approximation becomes reasonable around df = 30 or higher, but this is not an exact threshold. The chi-square distribution always remains bounded at zero, unlike the normal distribution, which extends across all real numbers.
Both distributions are non-negative and right-skewed at low degrees of freedom. An F-distributed variable is the ratio of two independent chi-square variables, each divided by their respective degrees of freedom: F(d₁, d₂) = [χ²(d₁)/d₁] / [χ²(d₂)/d₂]. This relationship connects ANOVA, regression F-tests, and chi-square variance tests within a unified theoretical framework.
Yes, for an upper-tail chi-square test with fixed degrees of freedom, a larger observed statistic always produces a smaller p-value. The upper-tail area P(X ≥ χ²) decreases as χ² increases. This is why chi-square tests treat large statistics as evidence against the null hypothesis — greater observed departures from expected values produce larger statistics and smaller p-values.
Fisher's exact test is an alternative to the chi-square test of independence that does not rely on a large-sample approximation. It computes the exact probability of the observed table and all more extreme tables, given fixed marginal totals. It is particularly useful when expected cell counts are small (say, below 5), the overall sample size is small, or when you want an exact result rather than an approximation. See our Fisher's exact test guide for detailed worked examples.
The mode is max(k − 2, 0). For df = 1, the mode is 0, meaning the distribution peaks at zero. For df = 2, the mode is still 0. For df ≥ 3, the mode is k − 2, which is positive and moves right as df increases. You can verify this by observing the peak of the curve in the visualizer above as you change the df slider.
Explore More on Statistics Fundamentals
Learn more about related concepts and tests at Statistics Fundamentals, your complete resource for statistics education and tools.
Pearson, K. (1900). On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling. Philosophical Magazine, 50, 157–175. — The original publication introducing what became the chi-square goodness-of-fit test.
NIST/SEMATECH e-Handbook of Statistical Methods. itl.nist.gov/div898/handbook/ — A comprehensive public resource on statistical distributions and tests.
Agresti, A. (2002). Categorical Data Analysis (2nd ed.). Wiley. — The standard reference for chi-square tests in contingency table analysis.