# Q-function

A plot of the Q-function.

In statistics, the Q-function is the tail distribution function of the standard normal distribution.[1][2] In other words, ${\displaystyle Q(x)}$ is the probability that a normal (Gaussian) random variable will obtain a value larger than ${\displaystyle x}$ standard deviations. Equivalently, ${\displaystyle Q(x)}$ is the probability that a standard normal random variable takes a value larger than ${\displaystyle x}$.

If ${\displaystyle Y}$ is a Gaussian random variable with mean ${\displaystyle \mu }$ and variance ${\displaystyle \sigma ^{2}}$, then ${\displaystyle X={\frac {Y-\mu }{\sigma }}}$ is standard normal and

${\displaystyle P(Y>y)=P(X>x)=Q(x)}$

where ${\displaystyle x={\frac {y-\mu }{\sigma }}}$.

Other definitions of the Q-function, all of which are simple transformations of the normal cumulative distribution function, are also used occasionally.[3]

Because of its relation to the cumulative distribution function of the normal distribution, the Q-function can also be expressed in terms of the error function, which is an important function in applied mathematics and physics.

## Definition and basic properties

Formally, the Q-function is defined as

${\displaystyle Q(x)={\frac {1}{\sqrt {2\pi }}}\int _{x}^{\infty }\exp \left(-{\frac {u^{2}}{2}}\right)\,du.}$

Thus,

${\displaystyle Q(x)=1-Q(-x)=1-\Phi (x)\,\!,}$

where ${\displaystyle \Phi (x)}$ is the cumulative distribution function of the normal Gaussian distribution.

The Q-function can be expressed in terms of the error function, or the complementary error function, as[2]

{\displaystyle {\begin{aligned}Q(x)&={\frac {1}{2}}\left({\frac {2}{\sqrt {\pi }}}\int _{x/{\sqrt {2}}}^{\infty }\exp \left(-t^{2}\right)\,dt\right)\\&={\frac {1}{2}}-{\frac {1}{2}}\operatorname {erf} \left({\frac {x}{\sqrt {2}}}\right)~~{\text{ -or-}}\\&={\frac {1}{2}}\operatorname {erfc} \left({\frac {x}{\sqrt {2}}}\right).\end{aligned}}}

An alternative form of the Q-function known as Craig's formula, after its discoverer, is expressed as:[4]

${\displaystyle Q(x)={\frac {1}{\pi }}\int _{0}^{\frac {\pi }{2}}\exp \left(-{\frac {x^{2}}{2\sin ^{2}\theta }}\right)d\theta .}$

This expression is valid only for positive values of x, but it can be used in conjunction with Q(x) = 1 − Q(−x) to obtain Q(x) for negative values. This form is advantageous in that the range of integration is fixed and finite.

## Bounds and approximations

• The Q-function is not an elementary function. However, the bounds, where ${\displaystyle \phi (x)}$ is the density function of the standard normal distribution,[5]
${\displaystyle \left({\frac {x}{1+x^{2}}}\right)\phi (x)0,}$
become increasingly tight for large x, and are often useful.
Using the substitution v =u2/2, the upper bound is derived as follows:
${\displaystyle Q(x)=\int _{x}^{\infty }\phi (u)\,du<\int _{x}^{\infty }{\frac {u}{x}}\phi (u)\,du=\int _{\frac {x^{2}}{2}}^{\infty }{\frac {e^{-v}}{x{\sqrt {2\pi }}}}\,dv=-{\biggl .}{\frac {e^{-v}}{x{\sqrt {2\pi }}}}{\biggr |}_{\frac {x^{2}}{2}}^{\infty }={\frac {\phi (x)}{x}}.}$
Similarly, using ${\displaystyle \phi '(u)=-u\phi (u)}$ and the quotient rule,
${\displaystyle \left(1+{\frac {1}{x^{2}}}\right)Q(x)=\int _{x}^{\infty }\left(1+{\frac {1}{x^{2}}}\right)\phi (u)\,du>\int _{x}^{\infty }\left(1+{\frac {1}{u^{2}}}\right)\phi (u)\,du=-{\biggl .}{\frac {\phi (u)}{u}}{\biggr |}_{x}^{\infty }={\frac {\phi (x)}{x}}.}$
Solving for Q(x) provides the lower bound.
The geometric mean of the upper and lower bound gives a suitable approximation for Q(x):
${\displaystyle Q(x)\approx {\frac {\phi (x)}{\sqrt {1+x^{2}}}},\qquad x\geq 0.}$
• Tighter bounds and approximations of the Q(x) can also be obtained by optimizing the following expression [5]
${\displaystyle Q_{a}(x)={\frac {\phi (x)}{(1-a)x+a{\sqrt {x^{2}+b}}}}.}$
For ${\displaystyle x\geq 0}$, the best upper bound is given by ${\displaystyle a=0.344}$ and ${\displaystyle b=5.334}$ with maximum absolute relative error of 0.44%. Likewise, the best approximation is given by ${\displaystyle a=0.339}$ and ${\displaystyle b=5.510}$ with maximum absolute relative error of 0.27%. Finally, the best lower bound is given by ${\displaystyle a=1/\pi }$ and ${\displaystyle b=2\pi }$ with maximum absolute relative error of 1.17%.
${\displaystyle Q(x)\leq e^{-{\frac {x^{2}}{2}}},\qquad x>0}$
• Improved exponential bounds and a pure exponential approximation are [6]
${\displaystyle Q(x)\leq {\tfrac {1}{4}}e^{-x^{2}}+{\tfrac {1}{4}}e^{-{\frac {x^{2}}{2}}}\leq {\tfrac {1}{2}}e^{-{\frac {x^{2}}{2}}},\qquad x>0}$
${\displaystyle Q(x)\approx {\frac {1}{12}}e^{-{\frac {x^{2}}{2}}}+{\frac {1}{4}}e^{-{\frac {2}{3}}x^{2}},\qquad x>0}$
• Another approximation of ${\displaystyle Q(x)}$ for ${\displaystyle x\in [0,\infty )}$ is given by Karagiannidis & Lioumpas (2007)[7] who showed for the appropriate choice of parameters ${\displaystyle \{A,B\}}$ that
${\displaystyle f(x;A,B)={\frac {\left(1-e^{-Ax}\right)e^{-x^{2}}}{B{\sqrt {\pi }}x}}\approx \operatorname {erfc} \left(x\right).}$
The absolute error between ${\displaystyle f(x;A,B)}$ and ${\displaystyle \operatorname {erfc} (x)}$ over the range ${\displaystyle [0,R]}$ is minimized by evaluating
${\displaystyle \{A,B\}={\underset {\{A,B\}}{\arg \min }}{\frac {1}{R}}\int _{0}^{R}|f(x;A,B)-\operatorname {erfc} (x)|dx.}$
Using ${\displaystyle R=20}$ and numerically integrating, they found the minimum error occurred when ${\displaystyle \{A,B\}=\{1.98,1.135\},}$ which gave a good approximation for ${\displaystyle \forall x\geq 0.}$
Substituting these values and using the relationship between ${\displaystyle Q(x)}$ and ${\displaystyle \operatorname {erfc} (x)}$ from above gives
${\displaystyle Q(x)\approx {\frac {\left(1-e^{-1.4x}\right)e^{-{\frac {x^{2}}{2}}}}{1.135{\sqrt {2\pi }}x}},x\geq 0.}$

## Inverse Q

The inverse Q-function can be related to the inverse error functions:

${\displaystyle Q^{-1}(y)={\sqrt {2}}\ \mathrm {erf} ^{-1}(1-2y)={\sqrt {2}}\ \mathrm {erfc} ^{-1}(2y)}$

The function ${\displaystyle Q^{-1}(y)}$ finds application in digital communications. It is usually expressed in dB and generally called Q-factor:

${\displaystyle \mathrm {Q{\text{-}}factor} =20\log _{10}\!\left(Q^{-1}(y)\right)\!~\mathrm {dB} }$

where y is the bit-error rate (BER) of the digitally modulated signal under analysis. For instance, for QPSK in additive white Gaussian noise, the Q-factor defined above coincides with the value in dB of the signal to noise ratio that yields a bit error rate equal to y.

Q-factor vs. bit error rate (BER).

## Values

The Q-function is well tabulated and can be computed directly in most of the mathematical software packages such as R and those available in Python, MATLAB and Mathematica. Some values of the Q-function are given below for reference.

## Generalization to high dimensions

The Q-function can be generalized to higher dimensions:[8]

${\displaystyle Q(\mathbf {x} )=\mathbb {P} (\mathbf {X} \geq \mathbf {x} ),}$

where ${\displaystyle \mathbf {X} \sim {\mathcal {N}}(\mathbf {0} ,\,\Sigma )}$ follows the multivariate normal distribution with covariance ${\displaystyle \Sigma }$ and the threshold is of the form ${\displaystyle \mathbf {x} =\gamma \Sigma \mathbf {l} ^{*}}$ for some positive vector ${\displaystyle \mathbf {l} ^{*}>\mathbf {0} }$ and positive constant ${\displaystyle \gamma >0}$. As in the one dimensional case, there is no simple analytical formula for the Q-function. Nevertheless, the Q-function can be approximated arbitrarily well as ${\displaystyle \gamma }$ becomes larger and larger.[9][10]

## References

1. ^ The Q-function, from cnx.org
2. ^ a b Basic properties of the Q-function Archived March 25, 2009, at the Wayback Machine
3. ^ Normal Distribution Function - from Wolfram MathWorld
4. ^ John W. Craig, A new, simple and exact result for calculating the probability of error for two-dimensional signal constellations, Proceedings of the 1991 IEEE Military Communication Conference, vol. 2, pp. 571–575.
5. ^ a b P.O. Borjesson and C-E.W. Sundberg, Simple approximations of the error function Q(x) for communications applications ]. 1979. Transactions on Communications, IEEE, 27(3), pp. 639-643.
6. ^ Chiani, M., Dardari, D., Simon, M.K. New Exponential Bounds and Approximations for the Computation of Error Probability in Fading Channels (2003). IEEE Transactions on Wireless Communications, 4(2), pp. 840–845. doi=10.1109/TWC.2003.814350.
7. ^ Karagiannidis, G. K., & Lioumpas, A. S. An improved approximation for the Gaussian Q-function. 2007. IEEE Communications Letters, 11(8), pp. 644-646.
8. ^ Savage, I. R. (1962). "Mills ratio for multivariate normal distributions". Journal Res. Nat. Bur. Standards Sect. B. 66: 93–96.
9. ^ Botev, Z. I. (2016). "The normal law under linear restrictions: simulation and estimation via minimax tilting". Journal of the Royal Statistical Society, Series B. arXiv:1603.04166. doi:10.1111/rssb.12162.
10. ^ Botev, Z. I.; Mackinlay, D.; Chen, Y.-L. (2017). "Logarithmically efficient estimation of the tail of the multivariate normal distribution". 2017 Winter Simulation Conference (WSC). 3th–6th Dec 2017 Las Vegas, NV, USA: IEEE. pp. 1903–1913. doi:10.1109/WSC.2017.8247926. ISBN 978-1-5386-3428-8.