Neha Patil (Editor)

Gaussian function

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Gaussian function

In mathematics, a Gaussian function, often simply referred to as a Gaussian, is a function of the form:

Contents

f ( x ) = a e ( x b ) 2 2 c 2

for arbitrary real constants a, b and 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 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.

Properties

Gaussian functions arise by composing the exponential function with a concave quadratic function. 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

F W H M = 2 2 ln 2   c 2.35482 c .

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 and x = b + c.

The full width at tenth of maximum (FWTM) for a Gaussian could be of interest and is

F W T M = 2 2 ln 10   c 4.29193 c .

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

e x 2 d x = π

and one obtains

a e ( x b ) 2 2 c 2 d x = a c 2 π .

This integral is 1 if and only if a = 1 c 2 π , 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:

g ( x ) = 1 σ 2 π e 1 2 ( x μ σ ) 2 .

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, 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:

k Z exp ( π ( k c ) 2 ) = c k Z exp ( π ( k c ) 2 ) .

Integral of a Gaussian function

The integral of an arbitrary Gaussian function is

a e ( x b ) 2 / 2 c 2 d x = 2 a | c | π .

An alternative form is

k e f x 2 + g x + h d x = k 2 f e f ( x g / ( 2 f ) ) 2 + g 2 / ( 4 f ) + h d x = k π f exp ( g 2 4 f + h ) ,

where f must be strictly positive for the integral to converge.

Proof

The integral

a e ( x b ) 2 / 2 c 2 d x

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 e y 2 / 2 c 2 d y ,

and then to z = y / 2 c 2

a 2 c 2 e z 2 d z .

Then, using the Gaussian integral identity

e z 2 d z = π ,

we have

a e ( x b ) 2 / 2 c 2 d x = a 2 π c 2 .

Two-dimensional Gaussian function

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 ( ( ( x x o ) 2 2 σ x 2 + ( y y o ) 2 2 σ y 2 ) ) .

Here the coefficient A is the amplitude, xo,yo 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, xo = 0, yo = 0, σx = σy = 1.

The volume under the Gaussian function is given by

V = f ( x , y ) d x d y = 2 π A σ x σ y .

In general, a two-dimensional elliptical Gaussian function is expressed as

f ( x , y ) = A exp ( ( a ( x x o ) 2 2 b ( x x o ) ( y y o ) + c ( y y o ) 2 ) )

where the matrix

[ a b b c ]

is positive-definite.

Using this formulation, the figure on the right can be created using A = 1, (xo, yo) = (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 (xoyo) is the center of the blob.

If we set

a = cos 2 θ 2 σ x 2 + sin 2 θ 2 σ y 2 b = sin 2 θ 4 σ x 2 + sin 2 θ 4 σ y 2 c = sin 2 θ 2 σ x 2 + cos 2 θ 2 σ y 2

then we rotate the blob by a clockwise angle θ (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

Such functions are often used in image processing and in computational models of visual system function—see the articles on scale space and affine shn.

Also see multivariate normal distribution.

Higher-order Gaussian or Super-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, P :

f ( x ) = A exp ( ( ( x x o ) 2 2 σ x 2 ) P ) . 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 ( ( ( x x o ) 2 2 σ x 2 + ( y y o ) 2 2 σ y 2 ) P ) or a rectangular Gaussian distribution, f ( x , y ) = A exp ( ( ( x x o ) 2 2 σ x 2 ) P x ( ( y y o ) 2 2 σ y 2 ) P y ) .

Multi-dimensional Gaussian function

In an n -dimensional space a Gaussian function can be defined as

f ( x ) = exp ( x T A x ) ,

where x = { x 1 , , x n } is a column of n coordinates, A is a positive-definite n × n matrix, and T denotes matrix transposition.

The integral of this Gaussian function over the whole n -dimensional space is given as

R n exp ( x T A x ) d x = π n det A .

It can be easily calculated by diagonalizing the matrix A and changing the integration variables to the eigenvectors of A .

More generally a shifted Gaussian function is defined as

f ( x ) = exp ( x T A x + s T x ) ,

where s = { s 1 , , s n } is the shift vector and the matrix A can be assumed to be symmetric, A T = A , and positive-definite. The following integrals with this function can be calculated with the same technique,

R n e x T A x + v T x d x = π n det A exp ( 1 4 v T A 1 v ) M . R n e x T A x + v T x ( a T x ) d x = ( a T u ) M , w h e r e u = 1 2 A 1 v . R n e x T A x + v T x ( x T D x ) d x = ( u T D u + 1 2 t r ( D A 1 ) ) M . R n e x T A x + s T x ( x Λ x ) e x T A x + s T x d x = = ( 2 t r ( A Λ A B 1 ) + 4 u T A Λ A u 2 u T ( A Λ s + A Λ s ) + s T Λ s ) M , w h e r e u = 1 2 B 1 v , v = s + s , B = A + A .

Gaussian profile estimation

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. These are a , b , and c for a 1D Gaussian function, A , ( x 0 , y 0 ) , and ( σ x , σ y ) for a 2D Gaussian function. The most common method for estimating the profile parameters is to take the logarithm of the data and fit a parabola to the resulting data set. While this provides a simple least squares fitting procedure, the resulting algorithm is biased by excessively weighting small data values, and this can produce large errors in the profile estimate. One can partially compensate for this through weighted least squares estimation, in which the small data values are given small weights, 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 iterative procedure in which the weights are updated at each iteration (see Iteratively reweighted least squares).

Once one has an algorithm for estimating the Gaussian function parameters, it is also important to know how accurate those estimates are. While an 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 use Cramér–Rao bound theory to obtain an analytical expression for the lower bound on the parameter variances, given some assumptions about the data.

  1. The noise in the measured profile is either i.i.d. Gaussian, or the noise is Poisson-distributed.
  2. The spacing between each sampling (i.e. the distance between pixels measuring the data) is uniform.
  3. 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.
  4. 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:

K Gauss = σ 2 π δ x Q 2 ( 3 2 c 0 1 a 0 2 c a 2 0 1 a 0 2 c a 2 )   , K Poiss = 1 2 π ( 3 a 2 c 0 1 2 0 c a 0 1 2 0 c 2 a )   ,

where δ x is the width of the pixels used to sample the function, Q 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,

var ( a ) = 3 σ 2 2 π δ x Q 2 c var ( b ) = 2 σ 2 c δ x π Q 2 a 2 var ( c ) = 2 σ 2 c δ x π Q 2 a 2

and in the Poisson noise case,

var ( a ) = 3 a 2 2 π c var ( b ) = c 2 π a var ( c ) = c 2 2 π a .  

For the 2D profile parameters giving the amplitude A , position ( x 0 , y 0 ) , and width ( σ x , σ y ) of the profile, the following covariance matrices apply:

K Gauss = σ 2 π δ x δ y Q 2 ( 2 σ x σ y 0 0 1 A σ y 1 A σ x 0 2 σ x A 2 σ y 0 0 0 0 0 2 σ y A 2 σ x 0 0 1 A σ y 0 0 2 σ x A 2 σ y 0 1 A σ x 0 0 0 2 σ y A 2 σ x )   , K Poiss = 1 2 π ( 3 A σ x σ y 0 0 1 σ y 1 σ x 0 σ x A σ y 0 0 0 0 0 σ y A σ x 0 0 1 σ y 0 0 2 σ x 3 A σ y 1 3 A 1 σ x 0 0 1 3 A 2 σ y 3 A σ x )   .

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 discrete Gaussian kernel:

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.

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 (chemistry)).
  • Mathematically, the derivatives of the Gaussian function can be represented using Hermite functions. 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 and microwave systems.
  • 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.
  • References

    Gaussian function Wikipedia


    Similar Topics