I need to compute the conditional probability of bivariate normal distribution over a line. Let's suppose that X and Y both are normal distributions and that they are independent. Let's suppose that we want to find the probability that a point 'k' will be on the line L= aX+bY=c. To do so we need to compute the following:
$ p(k|aX+bY=c) = \frac {p_x(X_k)p_y(Y_k)}{p(aX+bY=c)} = \frac {p_x(X_k)p_y(Y_k)}{\int_{L} p_x(X)p_y(Y) dX dY}$

where k is point over the line L. For this to happen we will use a base for the line L define as a vector b(b1,b2) and a point of origin r(r1,r2). Therefore, the previous integral can be written as:
$ \frac {p_x(X_k)p_y(Y_k)}{\int_{t} p_x(r_1+b_1t)p_y(r_2+b_2t) dt} = \frac {p_x(r_1+b_1k)p_y(r_2+b_2k)}{\int_{t} p_x(r_1+b_1t)p_y(r_2+b_2t) dt}$

My goal now is to show that this last fraction is indeed a gaussian distribution and to get its mean and variance

  • $\begingroup$ (1) It is essential that $(X,Y)$ have a bivariate Normal distribution: marginal (univariate) Normal distributions do not give sufficient information. (2) Assuming that, and assuming it is nondegenerate, then there exist $a^\prime$ and $b^\prime$ (easily found in terms of the covariance matrix of $(X,Y)$) for which $(U,V)=(aX+bY, a^\prime X+b^\prime Y)$ are independent and Binormal, reducing the question to a triviality. $\endgroup$
    – whuber
    May 12 at 21:35
  • $\begingroup$ @whuber I tried to make my question clearer. Could explain what said differently? $\endgroup$
    – sam
    May 12 at 21:39

2 Answers 2


A bivariate normal density can be likened to a piece of bologna (or did I mean to write baloney?) about which Americans often say "No matter how you slice it, it is still bologna". The meaning w.r.t. bivariate normal densities (regarded as a piece of bologna sitting on the $x$-$y$ plane) is that every cross-section of this piece (of lunch meat) has the shape of a univariate normal density. Slice it along the straight line $ax+by=c$ and the cross-section has the shape of a normal density. It is not exactly a univariate normal density in that the "area under the curve" in usually not $1$ as it must be for all valid univariate densities, but for any nonnegative function $g(x)$ with finite area $A$, $A^{-1}g(x)$ is a valid density function. So, as I said, the shape is of the correct form, but the area need not be, but the area is readily fixed.

So, what is the density of $aX+bY+c$ when $(X,Y)$ is bivariate normal? Easy-peasy -- it is a normal density with mean $$E[aX+bY+c] = a\mu_x +b\mu_Y +c$$ and variance $$\operatorname{var}(aX+bY+c) = a^2\operatorname{var}(X) + b^2\operatorname{var}(Y) +2ab\operatorname{cov}(X,Y).$$

  • $\begingroup$ thank you for your answer. So is the result oof this :$ \frac {p_x(r_1+b_1k)p_y(r_2+b_2k)}{\int_{t} p_x(r_1+b_1t)p_y(r_2+b_2t) dt}$ is a gaussian with the specified parameters? and how those parameters relate to the base that I defined for the line? $\endgroup$
    – sam
    May 13 at 5:13
  • $\begingroup$ This is an excellent analysis. However, the question doesn't ask for this marginal distribution: it requests the conditional distribution. $\endgroup$
    – whuber
    May 13 at 12:10

Let $X$ and $Y$ be jointly normal random variables with means $\mu_X, \mu_Y$, and covariance matrix $\Sigma$. (We do not need that $X$ and $Y$ are independent, although it does simplify some calculations.)

$$ \begin{pmatrix}X\\Y \end{pmatrix} \sim N(\begin{pmatrix}\mu_X \\ \mu_Y \end{pmatrix} , \begin{pmatrix}\Sigma_{11} & \Sigma_{12}\\ \Sigma_{21} & \Sigma_{22}\end{pmatrix}) $$

Pre-multiply by a matrix $A$ to transform the second variable into the 'variables-part' of desired line equation, $aX + bY$. As $A$ is fixed and $X,Y$ are jointly normal, the result is still jointly normal.

$$ A\begin{pmatrix}X\\Y \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ a & b \end{pmatrix}\begin{pmatrix}X\\Y \end{pmatrix} = \begin{pmatrix}X\\ aX + bY \end{pmatrix} \sim N(A\begin{pmatrix}\mu_X \\ \mu_Y \end{pmatrix} , A\begin{pmatrix}\Sigma_{11} & \Sigma_{12}\\ \Sigma_{21} & \Sigma_{22}\end{pmatrix}A^T) $$

The mean of this multivariate distribution is

$$\begin{pmatrix} \mu_X \\ a\mu_X + b\mu_Y \end{pmatrix}$$

and, for simplicity, denote the resulting variance as

$$ A\begin{pmatrix}\Sigma_{11} & \Sigma_{12}\\ \Sigma_{21} & \Sigma_{22}\end{pmatrix}A^T = \begin{pmatrix}\Omega_{11} & \Omega_{12}\\ \Omega_{21} & \Omega_{22}\end{pmatrix} $$

Finally, follow one of the answers in this question, Deriving the conditional distributions of a multivariate normal distribution, to prove that the distribution of $X$ conditional on $aX + bY = c$ has a normal distribution with mean

$$ \mu = \mu_X + \Omega_{12}\Omega_{22}^{-1}(c - a\mu_X - b\mu_Y) $$

and variance

$$ \sigma^2 = \Omega_{11} - \Omega_{12}\Omega_{22}^{-1}\Omega_{21} $$

We now have the conditional distribution of $X$ given $aX + bY = c$. The corresponding value of $Y$ can be easily found from the same line equation, $Y = c/b - (a/b)X$.

For a point $k$ along the line $(r_1 + b_1k, r_2 + b_2k)$ The conditional distribution of $X$ can be re-expressed to give the conditional distribution of $K$, by re-arranging $x = r_1 + b_1k$ to $k = (x - r_1)/b_1$

Therefore $K | aX + bY = c$ has a normal distribution with mean and variance

$$ \mu_K = \frac{\mu_X + \Omega_{12}\Omega_{22}^{-1}(c - a\mu_X - b\mu_Y) - r_1}{b_1} $$

$$ \sigma^2_{K} = \frac{\Omega_{11} - \Omega_{12}\Omega_{22}^{-1}\Omega_{21}}{b_1^2} $$

  • $\begingroup$ Thank you for your answer. I don't understand what is A could you explain more please? $\endgroup$
    – sam
    May 13 at 5:14
  • $\begingroup$ A is a 2x2 matrix made from the numbers 1, 0, a, b, where a and b are the values from the line we want to condition on: aX + bY = c. Because (X,Y)^T is a 2x1 random vector, multiplying A*(X,Y)^T gives us another 2x1 random vector. $\endgroup$ May 13 at 13:07
  • $\begingroup$ I still can't understand how this relate to my problem. I am looking for the conditional distribution of X,Y given the line and a base for the line but here you are looking for the conditional distribution of X given aX+bY=c $\endgroup$
    – sam
    May 13 at 13:33
  • 1
    $\begingroup$ @sam I don't understand what you mean. The conditional distribution of X,Y given aX +bY = c is known from the conditional distribution of X given aX + bY = c, because if we know that aX + bY = c, then we know that Y = c/b - (a/b)X. There isn't exactly a "joint" distribution, because conditioning on the line tells us the exact relationship between X and Y. Knowing X tells us exactly what Y is. $\endgroup$ May 13 at 14:01
  • $\begingroup$ I am not convinced that this really answers my question, because what I need is to find out that this fraction: $\frac {p_x(r_1+b_1k)p_y(r_2+b_2k)}{\int_{t} p_x(r_1+b_1t)p_y(r_2+b_2t) dt}$ is actually a gaussian distribution $\endgroup$
    – sam
    May 13 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.