In mathematics, a Gaussian function, often simply referred to as a Gaussian, is a function of the form $$ f(x) = a \cdot \exp\left( -\frac{(x - b)^2}{2c^2} \right) $$ 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 = c^2. In this case, the Gaussian is of the form $$ g(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp\left( -\frac{1}{2} \frac{(x - \mu)^2}{\sigma^2} \right). $$ 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. Gaussian functions arise by composing the exponential function with a concave quadratic function: $$ f(x) = \exp(\alpha x^2 + \beta x + \gamma), $$ where $$ \alpha = -1/2c^2, $$ $$ \beta = b/c^2, $$ $$ \gamma = \ln a-(b^2 / 2c^2). $$ 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 $$ \text{FWHM} = 2 \sqrt{2 \ln 2}c \approx 2.35482c. $$ The function may then be expressed in terms of the FWHM, represented by w: $$ f(x) = a e^{-4 (\ln 2) (x - b)^2 / w^2}. $$ 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 $$ \text{FWTM} = 2 \sqrt{2 \ln 10}c \approx 4.29193c. $$ 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 $$ \int_{-\infty}^\infty e^{-x^2} dx = \sqrt{\pi}, $$ and one obtains $$ \int_{-\infty}^\infty a e^{-(x - b)^2 / (2c^2)} dx = ac \cdot \sqrt{2\pi}. $$ This integral is 1 if and only if $a = \tfrac{1}{c\sqrt{2\pi}}$ (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 = c^2: $$ g(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp\left(\frac{-(x - \mu)^2}{2\sigma^2} \right). $$ These Gaussians are plotted in the accompanying figure. Gaussian functions centered at zero minimize the Fourier uncertainty principle. 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: $c^2 = c_1^2 + c_2^2$. The product of two Gaussian probability density functions (PDFs), though, is not in general a Gaussian PDF. 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 $c$, b = 0 and $1/c$. So in particular the Gaussian functions with b = 0 and $c = 1$ 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 identity from the Poisson summation formula: $$ \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). $$ The integral of an arbitrary Gaussian function is $$ \int_{-\infty}^\infty ae^{-(x - b)^2/2c^2}dx = \sqrt{2} a |c| \sqrt{\pi}. $$ An alternative form is $$ \int_{-\infty}^\infty ke^{-f x^2 + g x + h}dx = \int_{-\infty}^\infty ke^{-f \big(x - g/(2f)\big)^2 + g^2/(4f) + h}dx = k\sqrt{\frac{\pi}{f}}\exp\left(\frac{g^2}{4f} + h\right), $$ where f must be strictly positive for the integral to converge. The integral $$ \int_{-\infty}^\infty ae^{-(x - b)^2/2c^2}dx $$ 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: $$ a\int_{-\infty}^\infty e^{-y^2/2c^2}dy, $$ and then to $z = y/\sqrt{2 c^2}$: $$ a\sqrt{2 c^2} \int_{-\infty}^\infty e^{-z^2}dz. $$ Then, using the Gaussian integral identity $$ \int_{-\infty}^\infty e^{-z^2}dz = \sqrt{\pi}, $$ we have $$ \int_{-\infty}^\infty ae^{-(x-b)^2/2c^2}dx = a\sqrt{2\pi c^2}. $$ In two dimensions, the power to which e is raised 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 $$ f(x, y) = A \exp\left(-\left(\frac{(x - x_0)^2}{2\sigma_X^2} + \frac{(y - y_0)^2}{2\sigma_Y^2} \right)\right). $$ 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 $$ V = \int_{-\infty}^\infty \int_{-\infty}^\infty f(x, y)dx dy = 2 \pi A \sigma_X \sigma_Y. $$ In general, a two-dimensional elliptical Gaussian function is expressed as $$ f(x, y) = A \exp\Big(-\big(a(x - x_0)^2 + 2b(x - x_0)(y - y_0) + c(y - y_0)^2 \big)\Big), $$ where the matrix $$ \begin{bmatrix} a & b \\ b & c \end{bmatrix} $$ 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. 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 \begin{align} a &= \frac{\cos^2\theta}{2\sigma_X^2} + \frac{\sin^2\theta}{2\sigma_Y^2}, \\ b &= -\frac{\sin 2\theta}{4\sigma_X^2} + \frac{\sin 2\theta}{4\sigma_Y^2}, \\ c &= \frac{\sin^2\theta}{2\sigma_X^2} + \frac{\cos^2\theta}{2\sigma_Y^2}, \end{align} then we rotate the blob by a clockwise angle $\theta$ (for counterclockwise rotation, invert the signs in the b coefficient). This 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. 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 $P$: $$ f(x) = A \exp\left(-\left(\frac{(x - x_0)^2}{2\sigma_X^2}\right)^P\right). $$ This function is known as a super-Gaussian function and is often used for Gaussian beam formulation. In a two-dimensional formulation, a Gaussian function along $x$ and $y$ can be combined with potentially different $P_X$ and $P_Y$ to form an elliptical Gaussian distribution: $$ f(x , y) = A \exp\left(-\left(\frac{(x - x_0)^2}{2\sigma_X^2} + \frac{(y - y_0)^2}{2\sigma_Y^2}\right)^P\right) $$ or a rectangular Gaussian distribution: $$ f(x, y) = A \exp\left(-\left(\frac{(x - x_0)^2}{2\sigma_X^2}\right)^{P_X} - \left(\frac{(y - y_0)^2}{2\sigma_Y^2}\right)^{P_Y}\right). $$ In an $n$-dimensional space a Gaussian function can be defined as $$ f(x) = \exp(-x^T C x), $$ where $x = \{x_1, \dots, x_n\}$ is a column of $n$ coordinates, $C$ is a positive-definite $n \times n$ matrix, and ${}^T$ denotes matrix transposition. The integral of this Gaussian function over the whole $n$-dimensional space is given as $$ \int_{\mathbb{R}^n} \exp(-x^TCx) dx = \sqrt{\frac{\pi^n}{\det C}}. $$ It can be easily calculated by diagonalizing the matrix $C$ and changing the integration variables to the eigenvectors of $C$. More generally a shifted Gaussian function is defined as $$ f(x) = \exp(-x^T C x + s^T x), $$ where $s = \{s_1, \dots, s_n\}$ is the shift vector and the matrix $C$ can be assumed to be symmetric, $C^T = C$, and positive-definite. The following integrals with this function can be calculated with the same technique: $$ \int_{\mathbb{R}^n} e^{-x^T C x+v^Tx} dx = \sqrt{\frac{\pi^n}{\det{C}}} \exp\left(\frac{1}{4}v^T C^{-1}v\right) \equiv \mathcal{M}. $$ $$ \int_{\mathbb{R}^n} e^{- x^T C x + v^T x} (a^T x) dx = (a^T u) \cdot \mathcal{M}, \text{ where } u = \frac{1}{2} C^{-1} v. $$ $$ \int_{\mathbb{R}^n} e^{- x^T C x + v^T x} (x^T D x) dx = \left( u^T D u + \frac{1}{2} \operatorname{tr} (D C^{-1}) \right) \cdot \mathcal{M}. $$ $$ \int_{\mathbb{R}^n} e^{- x^T C' x + s'^T x} \left( -\frac{\partial}{\partial x} \Lambda \frac{\partial}{\partial x} \right) e^{-x^T C x + s^T x} dx = {} $$ $$ \qquad = \left( 2 \operatorname{tr}(C' \Lambda C B^{- 1}) + 4 u^T C' \Lambda C u - 2 u^T (C' \Lambda s + C \Lambda s') + s'^T \Lambda s \right) \cdot \mathcal{M}, $$ where $u = \frac{1}{2} B^{- 1} v,\ v = s + s',\ B = C + C'.$ 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 $(A; x_0,y_0; \sigma_X,\sigma_Y)$. 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. 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. # 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 $a$, $b$, and $c$ under i.i.d. Gaussian noise and under Poisson noise: $$ T(n, t) = e^{-t} I_n(t) $$ where $I_n(t)$ 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. 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 (chemistry)). * 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 defined by sampling a Gaussian, or in a different way. * 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.