Gaussian function: Difference between revisions
WikiHarold (talk | contribs) |
url |
||
| Line 1: | Line 1: | ||
{{Short description|Mathematical function}} | {{Short description|Mathematical function}} | ||
{{Redirect|Gaussian curve|the band|Gaussian Curve (band)}} | |||
In [[Mathematics|mathematics]], a '''Gaussian function''', often simply referred to as a '''Gaussian''', is a [[Function (mathematics)|function]] of the base form | In [[Mathematics|mathematics]], a '''Gaussian function''', often simply referred to as a '''Gaussian''', is a [[Function (mathematics)|function]] of the base form | ||
<math display="block">f(x) = \exp (-x^2)</math> | <math display="block">f(x) = \exp (-x^2)</math> | ||
| Line 16: | Line 14: | ||
== Properties == | == Properties == | ||
Gaussian functions arise by composing the [[Exponential function|exponential function]] with a [[Concave function|concave]] [[Quadratic function|quadratic function]]:<math display="block">f(x) = \exp(\alpha x^2 + \beta x + \gamma),</math>where | Gaussian functions arise by composing the [[Exponential function|exponential function]] with a [[Concave function|concave]] [[Quadratic function|quadratic function]]: | ||
<math display="block">f(x) = \exp\left(\alpha x^2 + \beta x + \gamma\right),</math> | |||
where | |||
<math display="block">\alpha = -\tfrac12 c^2, \qquad \beta = \frac{b}{c^2}, \qquad \gamma = \ln a-\frac{b^2}{2c^2}.</math> | |||
(Note: <math>a = 1 | (Note: <math display="inline">a = \frac{1}{\sigma\sqrt{2\pi}} </math> in <math> \ln a </math>, not to be confused with <math display="inline">\alpha = -\tfrac12 c^2</math>) | ||
The Gaussian functions are thus those functions whose [[Logarithm|logarithm]] is a concave quadratic function. | The Gaussian functions are thus those functions whose [[Logarithm|logarithm]] is a concave quadratic function. | ||
| Line 29: | Line 27: | ||
The function may then be expressed in terms of the FWHM, represented by {{mvar|w}}: | The function may then be expressed in terms of the FWHM, represented by {{mvar|w}}: | ||
<math display="block">f(x) = a | <math display="block">f(x) = a \exp\left(-\frac{4 (\ln 2) (x - b)^2 }{ w^2}\right).</math> | ||
Alternatively, the parameter {{mvar|c}} can be interpreted by saying that the two [[Inflection point|inflection point]]s of the function occur at {{math|1=<var>x</var> = <var>b</var> ± <var>c</var>}}. | Alternatively, the parameter {{mvar|c}} can be interpreted by saying that the two [[Inflection point|inflection point]]s of the function occur at {{math|1=<var>x</var> = <var>b</var> ± <var>c</var>}}. | ||
| Line 40: | Line 38: | ||
Gaussian functions are among those functions that are elementary but lack elementary [[Antiderivative|antiderivative]]s; the [[Integral|integral]] of the Gaussian function is the [[Error function|error function]]: | Gaussian functions are among those functions that are elementary but lack elementary [[Antiderivative|antiderivative]]s; the [[Integral|integral]] of the Gaussian function is the [[Error function|error function]]: | ||
<math display="block">\int | <math display="block">\int \exp\left(-x^2\right) \,dx = \frac{\sqrt\pi}{2} \operatorname{erf} x + C.</math> | ||
Nonetheless, their improper integrals over the whole real line can be evaluated exactly, using the [[Gaussian integral]] | Nonetheless, their improper integrals over the whole real line can be evaluated exactly, using the [[Gaussian integral]] | ||
<math display="block">\int_{-\infty}^\infty | <math display="block">\int_{-\infty}^\infty \exp\left(-x^2\right) \,dx = \sqrt{\pi},</math> | ||
and one obtains | and one obtains | ||
<math display="block">\int_{-\infty}^\infty a | <math display="block">\int_{-\infty}^\infty a \exp\left(-\frac{(x - b)^2 }{ 2c^2}\right) \,dx = ac \cdot \sqrt{2\pi}.</math> | ||
[[Image:Normal Distribution PDF.svg|thumb|360px|right|[[Normalizing constant|Normalized]] Gaussian curves with [[Expected value|expected value]] {{mvar|μ}} and [[Variance|variance]] {{math|<var>σ</var>{{sup|2}}}}. The corresponding parameters are <math display="inline">a = \tfrac{1}{\sigma\sqrt{2\pi}}</math>, {{math|1=<var>b</var> = <var>μ</var>}} and {{math|1=<var>c</var> = <var>σ</var>}}.]] | [[Image:Normal Distribution PDF.svg|thumb|360px|right|[[Normalizing constant|Normalized]] Gaussian curves with [[Expected value|expected value]] {{mvar|μ}} and [[Variance|variance]] {{math|<var>σ</var>{{sup|2}}}}. The corresponding parameters are <math display="inline">a = \tfrac{1}{\sigma\sqrt{2\pi}}</math>, {{math|1=<var>b</var> = <var>μ</var>}} and {{math|1=<var>c</var> = <var>σ</var>}}.]] | ||
This integral is 1 if and only if <math display="inline">a = \tfrac{1}{c\sqrt{2\pi}}</math> (the [[Normalizing constant|normalizing constant]]), and in this case the Gaussian is the [[Physics:Probability density function|probability density function]] of a [[Normal distribution|normally distributed]] [[Random variable|random variable]] with [[Expected value|expected value]] {{math|1=<var>μ</var> = <var>b</var>}} and [[Variance|variance]] {{math|1=<var>σ</var>{{sup|2}} = <var>c</var>{{sup|2}}}}: | This integral is 1 if and only if <math display="inline">a = \tfrac{1}{c\sqrt{2\pi}}</math> (the [[Normalizing constant|normalizing constant]]), and in this case the Gaussian is the [[Physics:Probability density function|probability density function]] of a [[Normal distribution|normally distributed]] [[Random variable|random variable]] with [[Expected value|expected value]] {{math|1=<var>μ</var> = <var>b</var>}} and [[Variance|variance]] {{math|1=<var>σ</var>{{sup|2}} = <var>c</var>{{sup|2}}}}: | ||
<math display="block">g(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp\left(\frac{ | <math display="block">g(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp\left(-\frac{(x - \mu)^2}{2\sigma^2} \right).</math> | ||
These Gaussians are plotted in the accompanying figure. | These Gaussians are plotted in the accompanying figure. | ||
| Line 58: | Line 56: | ||
The Fourier [[Fourier transform#Uncertainty principle|uncertainty principle]] becomes an equality if and only if (modulated) Gaussian functions are considered.<ref>{{cite journal | last1=Folland | first1=Gerald B. | last2=Sitaram | first2=Alladi | title=The uncertainty principle: A mathematical survey | journal=The Journal of Fourier Analysis and Applications | volume=3 | issue=3 | date=1997 | issn=1069-5869 | doi=10.1007/BF02649110 | pages=207–238| bibcode=1997JFAA....3..207F }}</ref> | The Fourier [[Fourier transform#Uncertainty principle|uncertainty principle]] becomes an equality if and only if (modulated) Gaussian functions are considered.<ref>{{cite journal | last1=Folland | first1=Gerald B. | last2=Sitaram | first2=Alladi | title=The uncertainty principle: A mathematical survey | journal=The Journal of Fourier Analysis and Applications | volume=3 | issue=3 | date=1997 | issn=1069-5869 | doi=10.1007/BF02649110 | pages=207–238| bibcode=1997JFAA....3..207F }}</ref> | ||
Taking the [[Fourier transform#Angular frequency (ω)|Fourier transform (unitary, angular-frequency convention)]] of a Gaussian function with parameters {{math|1=<var>a</var> = 1}}, {{math|1=<var>b</var> = 0}} and {{math|<var>c</var>}} yields another Gaussian function, with parameters <math>c</math>, {{math|1=<var>b</var> = 0}} and < | Taking the [[Fourier transform#Angular frequency (ω)|Fourier transform (unitary, angular-frequency convention)]] of a Gaussian function with parameters {{math|1=<var>a</var> = 1}}, {{math|1=<var>b</var> = 0}} and {{math|<var>c</var>}} yields another Gaussian function, with parameters <math>c</math>, {{math|1=<var>b</var> = 0}} and {{math|{{sfrac|1|<var>c</var>}}}}.<ref>{{cite web |last=Weisstein|first=Eric W. |title=Fourier Transform – Gaussian |url=https://mathworld.wolfram.com/FourierTransformGaussian.html |publisher=[[MathWorld]] |access-date=19 December 2013 }}</ref> So in particular the Gaussian functions with {{math|1=<var>b</var> = 0}} and {{math|1=<var>c</var> = a}} are kept fixed by the Fourier transform (they are [[Eigenfunction|eigenfunction]]s of the Fourier transform with eigenvalue 1). | ||
<!-- The way the Fourier transform is currently defined in its article (with pi in the exponent, also the way that I prefer), the Gaussian must also have a pi in its exponent. ~~~~ --> | <!-- The way the Fourier transform is currently defined in its article (with pi in the exponent, also the way that I prefer), the Gaussian must also have a pi in its exponent. ~~~~ --> | ||
A physical realization is that of the [[Physics:Fraunhofer diffraction#Diffraction by an aperture with a Gaussian profile|diffraction pattern]]: for example, a photographic slide whose [[Physics:Transmittance|transmittance]] has a Gaussian variation is also a Gaussian function. | A physical realization is that of the [[Physics:Fraunhofer diffraction#Diffraction by an aperture with a Gaussian profile|diffraction pattern]]: for example, a photographic slide whose [[Physics:Transmittance|transmittance]] has a Gaussian variation is also a Gaussian function. | ||
Using that the Gaussian function is an eigenfunction of the continuous Fourier transform | <!-- | ||
<math display="block">\sum_{k\in\ | Using [[Periodic summation|periodic summation]] and [[Discretization|discretization]] you can construct vectors from the Gaussian function, | ||
that behave similarly under the [[Discrete Fourier transform]]. | |||
Comparing the zeroth coefficient of the Discrete Fourier transform of such a vector | |||
with the periodic summation and discretization of the Continuous Fourier transform of the Gaussian yields the interesting identity: | |||
--> | |||
The fact that the Gaussian function is an eigenfunction of the continuous Fourier transform allows us to derive the following interesting{{clarify|date=August 2016}} identity from the [[Poisson summation formula]]: | |||
<math display="block">\sum_{k\in\Z} \exp\left(-\pi \cdot \left(\frac{k}{c}\right)^2\right) = c \cdot \sum_{k\in\Z} \exp\left(-\pi \cdot (kc)^2\right).</math> | |||
==Integral of a Gaussian function== | ==Integral of a Gaussian function== | ||
The integral of an arbitrary Gaussian function is<math display="block">\int_{-\infty}^\infty a\ | The integral of an arbitrary Gaussian function is | ||
<math display="block">\int_{-\infty}^\infty a \exp\left(-\frac{(x - b)^2}{2c^2}\right)\,dx = \ a \, |c| \, \sqrt{2\pi}.</math> | |||
An alternative form is<math display="block">\int_{-\infty}^\infty k\ | An alternative form is | ||
where | <math display="block">\begin{align} | ||
\int_{-\infty}^\infty k \exp\left(-f x^2 + g x + h\right)\,dx | |||
&= \int_{-\infty}^\infty k\exp\left(-f \left(x - \frac{g}{2f}\right)^2 + \frac{g^2}{4f} + h\right)\,dx \\ | |||
&= k\,\sqrt{\frac{\pi}{f}}\,\exp\left(\frac{g^2}{4f} + h\right), | |||
\end{align}</math> | |||
where {{mvar|f}} must be strictly positive for the integral to converge. | |||
===Relation to standard Gaussian integral=== | ===Relation to standard Gaussian integral=== | ||
The integral | The integral | ||
<math display="block">\int_{-\infty}^\infty | <math display="block">\int_{-\infty}^\infty a\exp\left(-\frac{(x - b)^2}{2c^2}\right)\,dx</math> | ||
for some [[Real number|real]] constants ''a'', ''b'' | for some [[Real number|real]] constants {{math|''a'', ''b'', ''c'' > 0}} can be calculated by putting it into the form of a [[Gaussian integral]]. First, the constant {{mvar|a}} can simply be factored out of the integral. Next, the variable of integration is changed from {{mvar|x}} to {{math|1=<var>y</var> = <var>x</var> − ''b''}}: | ||
<math display="block">a\int_{-\infty}^\infty | <math display="block">a\int_{-\infty}^\infty \exp\left(-\frac{y^2}{2c^2}\right)\,dy,</math> | ||
and then to <math>z = y | and then to <math display="inline">z = \frac{y}{\sqrt{2 c^2}}</math>: | ||
<math display="block">a\sqrt{2 c^2} \int_{-\infty}^\infty | <math display="block">a\sqrt{2 c^2} \int_{-\infty}^\infty \exp\left(-z^2\right)\,dz.</math> | ||
Then, using the [[Gaussian integral|Gaussian integral identity]] | Then, using the [[Gaussian integral|Gaussian integral identity]] | ||
<math display="block">\int_{-\infty}^\infty | <math display="block">\int_{-\infty}^\infty \exp\left(-z^2\right)\,dz = \sqrt{\pi},</math> | ||
we have | we have | ||
<math display="block">\int_{-\infty}^\infty | <math display="block">\int_{-\infty}^\infty a \exp\left(-\frac{(x-b)^2}{2c^2}\right)\,dx = a\sqrt{2\pi c^2}.</math> | ||
== Two-dimensional Gaussian function == | == Two-dimensional Gaussian function == | ||
[[File:Gaussian 2d surface.png|thumb|3d plot of a Gaussian function with a two-dimensional domain]] | [[File:Gaussian 2d surface.png|thumb|upright=2|3d plot of a Gaussian function with a two-dimensional domain]] | ||
Base form: | Base form: | ||
<math display="block">f(x,y) = \exp(-x^2-y^2)</math> | <math display="block">f(x,y) = \exp\left(-x^2-y^2\right)</math> | ||
In two dimensions, the | In two dimensions, the argument of the [[Exponential function|exponential function]] in the Gaussian function is any negative-definite [[Quadratic form|quadratic form]]. Consequently, the [[Level set|level set]]s of the Gaussian will always be ellipses. | ||
A particular example of a two-dimensional Gaussian function is | A particular example of a two-dimensional Gaussian function is | ||
| Line 103: | Line 113: | ||
In general, a two-dimensional elliptical Gaussian function is expressed as | In general, a two-dimensional elliptical Gaussian function is expressed as | ||
<math display="block">f(x, y) = A \exp\ | <math display="block">f(x, y) = A \exp\left(-\left(a(x - x_0)^2 + 2b(x - x_0)(y - y_0) + c(y - y_0)^2 \right)\right),</math> | ||
where the matrix | where the matrix | ||
<math display="block">\begin{bmatrix} a & b \\ b & c \end{bmatrix}</math> | <math display="block">\begin{bmatrix} a & b \\ b & c \end{bmatrix}</math> | ||
is [[Positive-definite matrix|positive-definite]]. | is [[Positive-definite matrix|positive-definite]]. | ||
Using this formulation, the figure on the right can be created using {{math|1=''A'' = 1}}, {{math|1=(''x''<sub>0</sub>, ''y''<sub>0</sub>) = (0, 0)}}, {{math|1=''a'' = ''c'' = 1 | Using this formulation, the figure on the right can be created using {{math|1=''A'' = 1}}, {{math|1=(''x''<sub>0</sub>, ''y''<sub>0</sub>) = (0, 0)}}, {{math|1=''a'' = ''c'' = {{sfrac|1|2}}}}, {{math|1=''b'' = 0}}. | ||
=== Meaning of parameters for the general equation === | === Meaning of parameters for the general equation === | ||
| Line 125: | Line 135: | ||
<math display="block">\begin{align} | <math display="block">\begin{align} | ||
\theta &= \frac{1}{2}\arctan\left(\frac{2b}{a-c}\right), \quad \theta \in [- | \theta &= \frac{1}{2}\arctan\left(\frac{2b}{a-c}\right), \quad \theta \in \left[-\tfrac{\pi}4, \tfrac{\pi}4 \right], \\ | ||
\sigma_X^2 &= \frac{1}{2 (a \cdot \cos^2\theta + 2 b \cdot \cos\theta\sin\theta + c \cdot \sin^2\theta)}, \\ | \sigma_X^2 &= \frac{1}{2 (a \cdot \cos^2\theta + 2 b \cdot \cos\theta\sin\theta + c \cdot \sin^2\theta)}, \\ | ||
\sigma_Y^2 &= \frac{1}{2 (a \cdot \sin^2\theta - 2 b \cdot \cos\theta\sin\theta + c \cdot \cos^2\theta)}. | \sigma_Y^2 &= \frac{1}{2 (a \cdot \sin^2\theta - 2 b \cdot \cos\theta\sin\theta + c \cdot \cos^2\theta)}. | ||
| Line 133: | Line 143: | ||
{| | {| | ||
| [[Image:Gaussian 2d 0 degrees.png|thumb| | | [[Image:Gaussian 2d 0 degrees.png|thumb|upright=1.5|<math>\theta = 0</math>]] | ||
| [[Image:Gaussian 2d 30 degrees.png|thumb| | | [[Image:Gaussian 2d 30 degrees.png|thumb|upright=1.5|<math>\theta = -\frac{\pi}{6}</math>]] | ||
| [[Image:Gaussian 2d 60 degrees.png|thumb| | | [[Image:Gaussian 2d 60 degrees.png|thumb|upright=1.5|<math>\theta = -\frac{\pi}{3}</math>]] | ||
|} | |} | ||
| Line 182: | Line 192: | ||
{{main|Multivariate normal distribution}} | {{main|Multivariate normal distribution}} | ||
In an <math>n</math>-dimensional space a Gaussian function can be defined as | In an <math>n</math>-dimensional space a Gaussian function can be defined as | ||
<math display="block">f(x) = \exp(-x^\mathsf{T} C x),</math> | <math display="block">f(x) = \exp\left(-x^\mathsf{T} C x\right),</math> | ||
where <math>x = \begin{bmatrix} x_1 & \cdots & x_n\end{bmatrix}</math> is a column of <math>n</math> coordinates, <math>C</math> is a [[Positive-definite matrix|positive-definite]] <math>n \times n</math> matrix, and <math>{}^\mathsf{T}</math> denotes [[Transpose|matrix transposition]]. | where <math>x = \begin{bmatrix} x_1 & \cdots & x_n\end{bmatrix}</math> is a column of <math>n</math> coordinates, <math>C</math> is a [[Positive-definite matrix|positive-definite]] <math>n \times n</math> matrix, and <math>{}^\mathsf{T}</math> denotes [[Transpose|matrix transposition]]. | ||
The integral of this Gaussian function over the whole <math>n</math>-dimensional space is given as | The integral of this Gaussian function over the whole <math>n</math>-dimensional space is given as | ||
<math display="block">\int_{\R^n} \exp(-x^\mathsf{T} C x) \, dx = \sqrt{\frac{\pi^n}{\det C}}.</math> | <math display="block">\int_{\R^n} \exp\left(-x^\mathsf{T} C x\right) \, dx = \sqrt{\frac{\pi^n}{\det C}}.</math> | ||
It can be easily calculated by diagonalizing the matrix <math>C</math> and changing the integration variables to the eigenvectors of <math>C</math>. | It can be easily calculated by diagonalizing the matrix <math>C</math> and changing the integration variables to the eigenvectors of <math>C</math>. | ||
More generally a shifted Gaussian function is defined as | More generally a shifted Gaussian function is defined as | ||
<math display="block">f(x) = \exp(-x^\mathsf{T} C x + s^\mathsf{T} x),</math> | <math display="block">f(x) = \exp\left(-x^\mathsf{T} C x + s^\mathsf{T} x\right),</math> | ||
where <math>s = \begin{bmatrix} s_1 & \cdots & s_n\end{bmatrix}</math> is the shift vector and the matrix <math>C</math> can be assumed to be symmetric, <math>C^\mathsf{T} = C</math>, and positive-definite. The following integrals with this function can be calculated with the same technique: | where <math>s = \begin{bmatrix} s_1 & \cdots & s_n\end{bmatrix}</math> is the shift vector and the matrix <math>C</math> can be assumed to be symmetric, <math>C^\mathsf{T} = C</math>, and positive-definite. The following integrals with this function can be calculated with the same technique: | ||
<math display="block">\int_{\R^n} e^{-x^\mathsf{T} C x + v^\mathsf{T}x} \, dx = \sqrt{\frac{\pi^n}{\det{C}}} \exp\left(\ | <math display="block">\int_{\R^n} e^{-x^\mathsf{T} C x + v^\mathsf{T}x} \, dx = \sqrt{\frac{\pi^n}{\det{C}}} \exp\left(\tfrac{1}{4} v^\mathsf{T} C^{-1} v\right) \equiv \mathcal{M}.</math> | ||
<math display="block">\int_{\mathbb{R}^n} e^{- x^\mathsf{T} C x + v^\mathsf{T} x} (a^\mathsf{T} x) \, dx = (a^T u) \cdot \mathcal{M}, \text{ where } u = \ | |||
<math display="block">\int_{\mathbb{R}^n} e^{- x^\mathsf{T} C x + v^\mathsf{T} x} (x^\mathsf{T} D x) \, dx = \left( u^\mathsf{T} D u + \ | <math display="block">\int_{\mathbb{R}^n} e^{- x^\mathsf{T} C x + v^\mathsf{T} x} \left(a^\mathsf{T} x\right) \, dx = \left(a^\mathsf{T} u\right) \cdot \mathcal{M}, \text{ where } u = \tfrac{1}{2} C^{-1} v.</math> | ||
<math display="block">\int_{\mathbb{R}^n} e^{- x^\mathsf{T} C x + v^\mathsf{T} x} \left(x^\mathsf{T} D x\right) \, dx = \left( u^\mathsf{T} D u + \tfrac{1}{2} \operatorname{tr} \left(D C^{-1}\right) \right) \cdot \mathcal{M}.</math> | |||
<math display="block">\begin{align} | <math display="block">\begin{align} | ||
& \int_{\mathbb{R}^n} e^{- x^\mathsf{T} C' x + s'^\mathsf{T} x} \left( -\frac{\partial}{\partial x} \Lambda \frac{\partial}{\partial x} \right) e^{-x^\mathsf{T} C x + s^\mathsf{T} x} \, dx \\ | & \int_{\mathbb{R}^n} e^{- x^\mathsf{T} C' x + s'^\mathsf{T} x} \left( -\frac{\partial}{\partial x} \Lambda \frac{\partial}{\partial x} \right) e^{-x^\mathsf{T} C x + s^\mathsf{T} x} \, dx \\ | ||
& \qquad = \left( 2 \operatorname{tr}(C' \Lambda C B^{- 1}) + 4 u^\mathsf{T} C' \Lambda C u - 2 u^\mathsf{T} (C' \Lambda s + C \Lambda s') + s'^\mathsf{T} \Lambda s \right) \cdot \mathcal{M}, | & \qquad = \left( 2 \operatorname{tr}\left(C' \Lambda C B^{- 1}\right) + 4 u^\mathsf{T} C' \Lambda C u - 2 u^\mathsf{T} \left(C' \Lambda s + C \Lambda s'\right) + s'^\mathsf{T} \Lambda s \right) \cdot \mathcal{M}, | ||
\end{align}</math> | \end{align}</math> | ||
where <math display=" | where | ||
<math display="block">u = \tfrac{1}{2} B^{- 1} v,\quad v = s + s',\quad B = C + C'.</math> | |||
== Estimation of parameters == | == Estimation of parameters == | ||
| Line 217: | Line 231: | ||
# The width of the peak is much larger than the distance between sample locations (i.e. the detector pixels must be at least 5 times smaller than the Gaussian FWHM). | # The width of the peak is much larger than the distance between sample locations (i.e. the detector pixels must be at least 5 times smaller than the Gaussian FWHM). | ||
When these assumptions are satisfied, the following [[Covariance matrix|covariance matrix]] '''K''' applies for the 1D profile parameters <math>a</math>, <math>b</math>, and <math>c</math> under i.i.d. Gaussian noise and under Poisson noise:<ref name="Hagen1" /> | When these assumptions are satisfied, the following [[Covariance matrix|covariance matrix]] '''K''' applies for the 1D profile parameters <math>a</math>, <math>b</math>, and <math>c</math> under i.i.d. Gaussian noise and under Poisson noise:<ref name="Hagen1" /> | ||
<math display="block"> \mathbf{K}_{\text{Gauss}} = \frac{\sigma^2}{\sqrt{\pi} \delta_X Q^2} \begin{pmatrix} \frac{3}{2c} &0 &\frac{ | <math display="block"> \mathbf{K}_{\text{Gauss}} = \frac{\sigma^2}{\sqrt{\pi} \delta_X Q^2} \begin{pmatrix} \frac{3}{2c} &0 &-\frac{1}{a} \\ 0 &\frac{2c}{a^2} &0 \\ -\frac{1}{a} &0 &\frac{2c}{a^2} \end{pmatrix} \ , | ||
\qquad | \qquad | ||
\mathbf{K}_\text{Poiss} = \frac{1}{\sqrt{2 \pi}} \begin{pmatrix} \frac{3a}{2c} &0 &-\frac{1}{2} \\ 0 &\frac{c}{a} &0 \\ -\frac{1}{2} &0 &\frac{c}{2a} \end{pmatrix} \ ,</math> | \mathbf{K}_\text{Poiss} = \frac{1}{\sqrt{2 \pi}} \begin{pmatrix} \frac{3a}{2c} &0 &-\frac{1}{2} \\ 0 &\frac{c}{a} &0 \\ -\frac{1}{2} &0 &\frac{c}{2a} \end{pmatrix} \ ,</math> | ||
| Line 238: | Line 252: | ||
<math display="block">\begin{align} | <math display="block">\begin{align} | ||
\mathbf{K}_\text{Gauss} = \frac{\sigma^2}{\pi \delta_X \delta_Y Q^2} & \begin{pmatrix} | \mathbf{K}_\text{Gauss} = \frac{\sigma^2}{\pi \delta_X \delta_Y Q^2} & \begin{pmatrix} | ||
\frac{2}{\sigma_X \sigma_Y} &0 &0 &\frac{ | \frac{2}{\sigma_X \sigma_Y} &0 &0 &-\frac{1}{A \sigma_Y} &-\frac{1}{A \sigma_X} \\ | ||
0 &\frac{2 \sigma_X}{A^2 \sigma_Y} &0 &0 &0 \\ | 0 &\frac{2 \sigma_X}{A^2 \sigma_Y} &0 &0 &0 \\ | ||
0 &0 &\frac{2 \sigma_Y}{A^2 \sigma_X} &0 &0 \\ | 0 &0 &\frac{2 \sigma_Y}{A^2 \sigma_X} &0 &0 \\ | ||
\frac{ | -\frac{1}{A \sigma_y} &0 &0 &\frac{2 \sigma_X}{A^2 \sigma_y} &0 \\ | ||
\frac{ | -\frac{1}{A \sigma_X} &0 &0 &0 &\frac{2 \sigma_Y}{A^2 \sigma_X} | ||
\end{pmatrix} \\[6pt] | \end{pmatrix} \\[6pt] | ||
\mathbf{K}_{\operatorname{Poisson}} = \frac{1}{2 \pi} & \begin{pmatrix} | \mathbf{K}_{\operatorname{Poisson}} = \frac{1}{2 \pi} & \begin{pmatrix} | ||
\frac{3A}{\sigma_X \sigma_Y} &0 &0 &\frac{ | \frac{3A}{\sigma_X \sigma_Y} &0 &0 &-\frac{1}{\sigma_Y} &-\frac{1}{\sigma_X} \\ | ||
0 & \frac{\sigma_X}{A \sigma_Y} &0 &0 &0 \\ 0 &0 &\frac{\sigma_Y}{A \sigma_X} &0 &0 \\ | 0 & \frac{\sigma_X}{A \sigma_Y} &0 &0 &0 \\ 0 &0 &\frac{\sigma_Y}{A \sigma_X} &0 &0 \\ | ||
\frac{ | -\frac{1}{\sigma_Y} &0 &0 &\frac{2 \sigma_X}{3A \sigma_Y} &\frac{1}{3A} \\ | ||
\frac{ | -\frac{1}{\sigma_X} &0 &0 &\frac{1}{3A} &\frac{2 \sigma_Y}{3A \sigma_X} | ||
\end{pmatrix}. | \end{pmatrix}. | ||
\end{align}</math> | \end{align}</math> | ||
| Line 254: | Line 268: | ||
== Discrete Gaussian == | == Discrete Gaussian == | ||
[[File:Discrete Gaussian kernel.svg|thumb|The discrete Gaussian kernel (solid), compared with the sampled Gaussian kernel (dashed) for scales <math>t = | [[File:Discrete Gaussian kernel.svg|thumb|The discrete Gaussian kernel (solid), compared with the sampled Gaussian kernel (dashed) for scales <math>t = \tfrac12,1,2,4.</math>]] | ||
One may ask for a discrete analog to the Gaussian; | One may ask for a discrete analog to the Gaussian; | ||
this is necessary in discrete applications, particularly [[Digital signal processing|digital signal processing]]. A simple answer is to sample the continuous Gaussian, yielding the sampled Gaussian kernel. However, this discrete function does not have the discrete analogs of the properties of the continuous function, and can lead to undesired effects, as described in the article [[Scale space implementation|scale space implementation]]. | this is necessary in discrete applications, particularly [[Digital signal processing|digital signal processing]]. A simple answer is to sample the continuous Gaussian, yielding the sampled Gaussian kernel. However, this discrete function does not have the discrete analogs of the properties of the continuous function, and can lead to undesired effects, as described in the article [[Scale space implementation|scale space implementation]]. | ||
| Line 267: | Line 281: | ||
Gaussian functions appear in many contexts in the natural sciences, the [[Social sciences|social sciences]], [[Mathematics|mathematics]], and [[Engineering:Engineering|engineering]]. Some examples include: | Gaussian functions appear in many contexts in the natural sciences, the [[Social sciences|social sciences]], [[Mathematics|mathematics]], and [[Engineering:Engineering|engineering]]. Some examples include: | ||
* In [[Statistics|statistics]] and [[Probability theory|probability theory]], Gaussian functions appear as the density function of the [[Normal distribution|normal distribution]], which is a limiting [[Probability distribution|probability distribution]] of complicated sums, according to the [[Central limit theorem|central limit theorem]]. | * In [[Statistics|statistics]] and [[Probability theory|probability theory]], Gaussian functions appear as the density function of the [[Normal distribution|normal distribution]], which is a limiting [[Probability distribution|probability distribution]] of complicated sums, according to the [[Central limit theorem|central limit theorem]]. | ||
* Gaussian functions are the [[Green's function]] for the (homogeneous and isotropic) [[Diffusion equation|diffusion equation]] (and to the [[Heat equation|heat equation]], which is the same thing), a [[Partial differential equation|partial differential equation]] that describes the time evolution of a mass-density under [[Physics:Diffusion|diffusion]]. Specifically, if the mass-density at time ''t''=0 is given by a Dirac delta, which essentially means that the mass is initially concentrated in a single point, then the mass-distribution at time ''t'' will be given by a Gaussian function, with the parameter '''''a''''' being linearly related to 1 | * Gaussian functions are the [[Green's function]] for the (homogeneous and isotropic) [[Diffusion equation|diffusion equation]] (and to the [[Heat equation|heat equation]], which is the same thing), a [[Partial differential equation|partial differential equation]] that describes the time evolution of a mass-density under [[Physics:Diffusion|diffusion]]. Specifically, if the mass-density at time ''t''=0 is given by a Dirac delta, which essentially means that the mass is initially concentrated in a single point, then the mass-distribution at time ''t'' will be given by a Gaussian function, with the parameter '''''a''''' being linearly related to {{sfrac|1|{{radic|''t''}}}} and '''''c''''' being linearly related to {{radic|''t''}}; this time-varying Gaussian is described by the [[Heat kernel|heat kernel]]. More generally, if the initial mass-density is φ(''x''), then the mass-density at later times is obtained by taking the [[Convolution|convolution]] of φ with a Gaussian function. The convolution of a function with a Gaussian is also known as a [[Weierstrass transform]]. | ||
* A Gaussian function is the [[Wave function|wave function]] of the [[Physics:Ground state|ground state]] of the [[Physics:Quantum harmonic oscillator|quantum harmonic oscillator]]. | * A Gaussian function is the [[Wave function|wave function]] of the [[Physics:Ground state|ground state]] of the [[Physics:Quantum harmonic oscillator|quantum harmonic oscillator]]. | ||
* The [[Chemistry:Molecular orbital|molecular orbital]]s used in [[Chemistry:Computational chemistry|computational chemistry]] can be [[Linear combination|linear combination]]s of Gaussian functions called [[Physics:Gaussian orbital|Gaussian orbital]]s (see also [[Chemistry:Basis set|basis set]]). | * The [[Chemistry:Molecular orbital|molecular orbital]]s used in [[Chemistry:Computational chemistry|computational chemistry]] can be [[Linear combination|linear combination]]s of Gaussian functions called [[Physics:Gaussian orbital|Gaussian orbital]]s (see also [[Chemistry:Basis set|basis set]]). | ||
| Line 292: | Line 306: | ||
==External links== | ==External links== | ||
* [ | * [https://mathworld.wolfram.com/GaussianFunction.html Mathworld, includes a proof for the relations between c and FWHM] | ||
* {{MathPages|id=home/kmath045/kmath045|title=Integrating The Bell Curve}} | * {{MathPages|id=home/kmath045/kmath045|title=Integrating The Bell Curve}} | ||
* [https://github.com/frecker/gaussian-distribution/ Haskell, Erlang and Perl implementation of Gaussian distribution] | * [https://github.com/frecker/gaussian-distribution/ Haskell, Erlang and Perl implementation of Gaussian distribution] | ||
Latest revision as of 10:32, 14 April 2026
In mathematics, a Gaussian function, often simply referred to as a Gaussian, is a function of the base form and with parametric extension for arbitrary real constants a, b and non-zero c. It is named after the mathematician Carl Friedrich Gauss. The graph of a Gaussian is a characteristic symmetric "bell curve" shape. The parameter a is the height of the curve's peak, b is the position of the center of the peak, and c (the standard deviation, sometimes called the Gaussian RMS width) controls the width of the "bell".
Gaussian functions are often used to represent the probability density function of a normally distributed random variable with expected value μ = b and variance σ2 = c2. In this case, the Gaussian is of the form[1]
Gaussian functions are widely used in statistics to describe the normal distributions, in signal processing to define Gaussian filters, in image processing where two-dimensional Gaussians are used for Gaussian blurs, and in mathematics to solve heat equations and diffusion equations and to define the Weierstrass transform. They are also abundantly used in quantum chemistry to form basis sets.
Properties
Gaussian functions arise by composing the exponential function with a concave quadratic function: where (Note: in , not to be confused with )
The Gaussian functions are thus those functions whose logarithm is a concave quadratic function.
The parameter c is related to the full width at half maximum (FWHM) of the peak according to
The function may then be expressed in terms of the FWHM, represented by w:
Alternatively, the parameter c can be interpreted by saying that the two inflection points of the function occur at x = b ± c.
The full width at tenth of maximum (FWTM) for a Gaussian could be of interest and is
Gaussian functions are analytic, and their limit as x → ∞ is 0 (for the above case of b = 0).
Gaussian functions are among those functions that are elementary but lack elementary antiderivatives; the integral of the Gaussian function is the error function:
Nonetheless, their improper integrals over the whole real line can be evaluated exactly, using the Gaussian integral and one obtains

This integral is 1 if and only if (the normalizing constant), and in this case the Gaussian is the probability density function of a normally distributed random variable with expected value μ = b and variance σ2 = c2:
These Gaussians are plotted in the accompanying figure.
The product of two Gaussian functions is a Gaussian, and the convolution of two Gaussian functions is also a Gaussian, with variance being the sum of the original variances: . The product of two Gaussian probability density functions (PDFs), though, is not in general a Gaussian PDF.
The Fourier uncertainty principle becomes an equality if and only if (modulated) Gaussian functions are considered.[2]
Taking the Fourier transform (unitary, angular-frequency convention) of a Gaussian function with parameters a = 1, b = 0 and c yields another Gaussian function, with parameters , b = 0 and 1/c.[3] So in particular the Gaussian functions with b = 0 and c = a are kept fixed by the Fourier transform (they are eigenfunctions of the Fourier transform with eigenvalue 1). A physical realization is that of the diffraction pattern: for example, a photographic slide whose transmittance has a Gaussian variation is also a Gaussian function.
The fact that the Gaussian function is an eigenfunction of the continuous Fourier transform allows us to derive the following interesting[clarification needed] identity from the Poisson summation formula:
Integral of a Gaussian function
The integral of an arbitrary Gaussian function is
An alternative form is where f must be strictly positive for the integral to converge.
Relation to standard Gaussian integral
The integral for some real constants a, b, c > 0 can be calculated by putting it into the form of a Gaussian integral. First, the constant a can simply be factored out of the integral. Next, the variable of integration is changed from x to y = x − b: and then to :
Then, using the Gaussian integral identity
we have
Two-dimensional Gaussian function

Base form:
In two dimensions, the argument of the exponential function in the Gaussian function is any negative-definite quadratic form. Consequently, the level sets of the Gaussian will always be ellipses.
A particular example of a two-dimensional Gaussian function is
Here the coefficient A is the amplitude, x0, y0 is the center, and σx, σy are the x and y spreads of the blob. The figure on the right was created using A = 1, x0 = 0, y0 = 0, σx = σy = 1.
The volume under the Gaussian function is given by
In general, a two-dimensional elliptical Gaussian function is expressed as where the matrix is positive-definite.
Using this formulation, the figure on the right can be created using A = 1, (x0, y0) = (0, 0), a = c = 1/2, b = 0.
Meaning of parameters for the general equation
For the general form of the equation the coefficient A is the height of the peak and (x0, y0) is the center of the blob.
If we set then we rotate the blob by a positive, counter-clockwise angle (for negative, clockwise rotation, invert the signs in the b coefficient).[4]
To get back the coefficients , and from , and use
Example rotations of Gaussian blobs can be seen in the following examples:
Using the following Octave code, one can easily see the effect of changing the parameters:
A = 1;
x0 = 0; y0 = 0;
sigma_X = 1;
sigma_Y = 2;
[X, Y] = meshgrid(-5:.1:5, -5:.1:5);
for theta = 0:pi/100:pi
a = cos(theta)^2 / (2 * sigma_X^2) + sin(theta)^2 / (2 * sigma_Y^2);
b = sin(2 * theta) / (4 * sigma_X^2) - sin(2 * theta) / (4 * sigma_Y^2);
c = sin(theta)^2 / (2 * sigma_X^2) + cos(theta)^2 / (2 * sigma_Y^2);
Z = A * exp(-(a * (X - x0).^2 + 2 * b * (X - x0) .* (Y - y0) + c * (Y - y0).^2));
surf(X, Y, Z);
shading interp;
view(-36, 36)
waitforbuttonpress
end
Such functions are often used in image processing and in computational models of visual system function—see the articles on scale space and affine shape adaptation.
Also see multivariate normal distribution.
Higher-order Gaussian or super-Gaussian function or generalized Gaussian function
A more general formulation of a Gaussian function with a flat-top and Gaussian fall-off can be taken by raising the content of the exponent to a power :
This function is known as a super-Gaussian function and is often used for Gaussian beam formulation.[5] This function may also be expressed in terms of the full width at half maximum (FWHM), represented by w:
In a two-dimensional formulation, a Gaussian function along and can be combined[6] with potentially different and to form a rectangular Gaussian distribution: or an elliptical Gaussian distribution:
Multi-dimensional Gaussian function
In an -dimensional space a Gaussian function can be defined as where is a column of coordinates, is a positive-definite matrix, and denotes matrix transposition.
The integral of this Gaussian function over the whole -dimensional space is given as
It can be easily calculated by diagonalizing the matrix and changing the integration variables to the eigenvectors of .
More generally a shifted Gaussian function is defined as where is the shift vector and the matrix can be assumed to be symmetric, , and positive-definite. The following integrals with this function can be calculated with the same technique:
where
Estimation of parameters
A number of fields such as stellar photometry, Gaussian beam characterization, and emission/absorption line spectroscopy work with sampled Gaussian functions and need to accurately estimate the height, position, and width parameters of the function. There are three unknown parameters for a 1D Gaussian function (a, b, c) and five for a 2D Gaussian function .
The most common method for estimating the Gaussian parameters is to take the logarithm of the data and fit a parabola to the resulting data set.[7][8] While this provides a simple curve fitting procedure, the resulting algorithm may be biased by excessively weighting small data values, which can produce large errors in the profile estimate. One can partially compensate for this problem through weighted least squares estimation, reducing the weight of small data values, but this too can be biased by allowing the tail of the Gaussian to dominate the fit. In order to remove the bias, one can instead use an iteratively reweighted least squares procedure, in which the weights are updated at each iteration.[8] It is also possible to perform non-linear regression directly on the data, without involving the logarithmic data transformation; for more options, see probability distribution fitting.
Parameter precision
Once one has an algorithm for estimating the Gaussian function parameters, it is also important to know how precise those estimates are. Any least squares estimation algorithm can provide numerical estimates for the variance of each parameter (i.e., the variance of the estimated height, position, and width of the function). One can also use Cramér–Rao bound theory to obtain an analytical expression for the lower bound on the parameter variances, given certain assumptions about the data.[9][10]
- The noise in the measured profile is either i.i.d. Gaussian, or the noise is Poisson-distributed.
- The spacing between each sampling (i.e. the distance between pixels measuring the data) is uniform.
- The peak is "well-sampled", so that less than 10% of the area or volume under the peak (area if a 1D Gaussian, volume if a 2D Gaussian) lies outside the measurement region.
- The width of the peak is much larger than the distance between sample locations (i.e. the detector pixels must be at least 5 times smaller than the Gaussian FWHM).
When these assumptions are satisfied, the following covariance matrix K applies for the 1D profile parameters , , and under i.i.d. Gaussian noise and under Poisson noise:[9] where is the width of the pixels used to sample the function, is the quantum efficiency of the detector, and indicates the standard deviation of the measurement noise. Thus, the individual variances for the parameters are, in the Gaussian noise case,
and in the Poisson noise case,
For the 2D profile parameters giving the amplitude , position , and width of the profile, the following covariance matrices apply:[10]
where the individual parameter variances are given by the diagonal elements of the covariance matrix.
Discrete Gaussian

One may ask for a discrete analog to the Gaussian; this is necessary in discrete applications, particularly digital signal processing. A simple answer is to sample the continuous Gaussian, yielding the sampled Gaussian kernel. However, this discrete function does not have the discrete analogs of the properties of the continuous function, and can lead to undesired effects, as described in the article scale space implementation.
An alternative approach is to use the discrete Gaussian kernel:[11] where denotes the modified Bessel functions of integer order.
This is the discrete analog of the continuous Gaussian in that it is the solution to the discrete diffusion equation (discrete space, continuous time), just as the continuous Gaussian is the solution to the continuous diffusion equation.[11][12]
Applications
Gaussian functions appear in many contexts in the natural sciences, the social sciences, mathematics, and engineering. Some examples include:
- In statistics and probability theory, Gaussian functions appear as the density function of the normal distribution, which is a limiting probability distribution of complicated sums, according to the central limit theorem.
- Gaussian functions are the Green's function for the (homogeneous and isotropic) diffusion equation (and to the heat equation, which is the same thing), a partial differential equation that describes the time evolution of a mass-density under diffusion. Specifically, if the mass-density at time t=0 is given by a Dirac delta, which essentially means that the mass is initially concentrated in a single point, then the mass-distribution at time t will be given by a Gaussian function, with the parameter a being linearly related to 1/√t and c being linearly related to √t; this time-varying Gaussian is described by the heat kernel. More generally, if the initial mass-density is φ(x), then the mass-density at later times is obtained by taking the convolution of φ with a Gaussian function. The convolution of a function with a Gaussian is also known as a Weierstrass transform.
- A Gaussian function is the wave function of the ground state of the quantum harmonic oscillator.
- The molecular orbitals used in computational chemistry can be linear combinations of Gaussian functions called Gaussian orbitals (see also basis set).
- Mathematically, the derivatives of the Gaussian function can be represented using Hermite functions. For unit variance, the n-th derivative of the Gaussian is the Gaussian function itself multiplied by the n-th Hermite polynomial, up to scale.
- Consequently, Gaussian functions are also associated with the vacuum state in quantum field theory.
- Gaussian beams are used in optical systems, microwave systems and lasers.
- In scale space representation, Gaussian functions are used as smoothing kernels for generating multi-scale representations in computer vision and image processing. Specifically, derivatives of Gaussians (Hermite functions) are used as a basis for defining a large number of types of visual operations.
- Gaussian functions are used to define some types of artificial neural networks.
- In fluorescence microscopy a 2D Gaussian function is used to approximate the Airy disk, describing the intensity distribution produced by a point source.
- In signal processing they serve to define Gaussian filters, such as in image processing where 2D Gaussians are used for Gaussian blurs. In digital signal processing, one uses a discrete Gaussian kernel, which may be approximated by the Binomial coefficient[13] or sampling a Gaussian.
- In geostatistics they have been used for understanding the variability between the patterns of a complex training image. They are used with kernel methods to cluster the patterns in the feature space.[14]
See also
References
- ↑ Squires, G. L. (2001-08-30). Practical Physics (4 ed.). Cambridge University Press. doi:10.1017/cbo9781139164498. ISBN 978-0-521-77940-1. https://www.cambridge.org/core/product/identifier/9781139164498/type/book.
- ↑ Folland, Gerald B.; Sitaram, Alladi (1997). "The uncertainty principle: A mathematical survey". The Journal of Fourier Analysis and Applications 3 (3): 207–238. doi:10.1007/BF02649110. ISSN 1069-5869. Bibcode: 1997JFAA....3..207F.
- ↑ Weisstein, Eric W.. "Fourier Transform – Gaussian". MathWorld. https://mathworld.wolfram.com/FourierTransformGaussian.html.
- ↑ Nawri, Nikolai. "Berechnung von Kovarianzellipsen". http://imkbemu.physik.uni-karlsruhe.de/~eisatlas/covariance_ellipses.pdf.
- ↑ Parent, A., M. Morin, and P. Lavigne. "Propagation of super-Gaussian field distributions". Optical and Quantum Electronics 24.9 (1992): S1071–S1079.
- ↑ "GLAD optical software commands manual, Entry on GAUSSIAN command". 2016-12-15. http://www.aor.com/anonymous/pub/commands.pdf.
- ↑ Caruana, Richard A.; Searle, Roger B.; Heller, Thomas.; Shupack, Saul I. (1986). "Fast algorithm for the resolution of spectra". Analytical Chemistry (American Chemical Society (ACS)) 58 (6): 1162–1167. doi:10.1021/ac00297a041. ISSN 0003-2700.
- ↑ 8.0 8.1 Hongwei Guo, "A simple algorithm for fitting a Gaussian function," IEEE Sign. Proc. Mag. 28(9): 134-137 (2011).
- ↑ 9.0 9.1 N. Hagen, M. Kupinski, and E. L. Dereniak, "Gaussian profile estimation in one dimension," Appl. Opt. 46:5374–5383 (2007)
- ↑ 10.0 10.1 N. Hagen and E. L. Dereniak, "Gaussian profile estimation in two dimensions," Appl. Opt. 47:6842–6851 (2008)
- ↑ 11.0 11.1 Lindeberg, T., "Scale-space for discrete signals," PAMI(12), No. 3, March 1990, pp. 234–254.
- ↑ Campbell, J, 2007, The SMM model as a boundary value problem using the discrete diffusion equation, Theor Popul Biol. 2007 Dec;72(4):539–46.
- ↑ Haddad, R.A. and Akansu, A.N., 1991, A Class of Fast Gaussian Binomial Filters for Speech and Image processing, IEEE Trans. on Signal Processing, 39-3: 723–727
- ↑ Honarkhah, M and Caers, J, 2010, Stochastic Simulation of Patterns Using Distance-Based Pattern Modeling, Mathematical Geosciences, 42: 487–517
Further reading
- Haberman, Richard (2013). "10.3.3 Inverse Fourier transform of a Gaussian". Applied Partial Differential Equations. Boston: PEARSON. ISBN 978-0-321-79705-6.
External links
- Mathworld, includes a proof for the relations between c and FWHM
- "Integrating The Bell Curve". MathPages.com. http://www.mathpages.com/home/kmath045/kmath045.htm.
- Haskell, Erlang and Perl implementation of Gaussian distribution
- Bensimhoun Michael, N-Dimensional Cumulative Function, And Other Useful Facts About Gaussians and Normal Densities (2009)
- Code for fitting Gaussians in ImageJ and Fiji.



