# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# chi2pdf

Chi-square probability density function

## Syntax

```Y = chi2pdf(X,V) ```

## Description

`Y = chi2pdf(X,V)` computes the chi-square pdf at each of the values in `X` using the corresponding degrees of freedom in `V`. `X` and `V` can be vectors, matrices, or multidimensional arrays that have the same size, which is also the size of the output `Y`. A scalar input is expanded to a constant array with the same dimensions as the other input. The degrees of freedom parameters in `V` must be positive, and the values in `X` must lie on the interval ```[0 Inf]```.

The chi-square pdf for a given value x and ν degrees of freedom is

`$y=f\left(x|\nu \right)=\frac{{x}^{\left(\nu -2\right)/2}{e}^{-x/2}}{{2}^{\nu /2}\Gamma \left(\nu /2\right)}$`

where Γ( · ) is the Gamma function.

If x is standard normal, then x2 is distributed chi-square with one degree of freedom. If x1, x2, ..., xn are n independent standard normal observations, then the sum of the squares of the x's is distributed chi-square with n degrees of freedom (and is equivalent to the gamma density function with parameters ν/2 and 2).

## Examples

```nu = 1:6; x = nu; y = chi2pdf(x,nu) y = 0.2420 0.1839 0.1542 0.1353 0.1220 0.1120```

The mean of the chi-square distribution is the value of the degrees of freedom parameter, `nu`. The above example shows that the probability density of the mean falls as `nu` increases.