# Variance and expectation of dot product

I am wondering what is the $E[\textbf{a}\cdot \textbf{b}]$ and $var[\textbf{a}\cdot \textbf{b}]$ where $\textbf{a}, \textbf{b}$ are independent random vectors. That is as a vector whose elements are random variables. There are n elemetns in the vector. Each element in vector is assumed to be random sample from a normal distribution with mean 0 and variance $\sigma^{2}=1/n$. and $\cdot$ denotes dot product.

I read somewhere that \begin{aligned} E(\tilde{\textbf{a}}\cdot \tilde{\textbf{b}})&=E(\sum_{i=1}^{n} a_{i} b_{i})\\ &= n E(XY)= 0 \end{aligned}

\begin{aligned} var(\tilde{\textbf{a}}\cdot \tilde{\textbf{b}})&=var(\sum_{i=1}^{n} a_{i} b_{i})\\ &=n~var(XY) \\ &=\dfrac{1}{n} \end{aligned}

How we can say $var(\sum_{i=1}^{n} a_{i} b_{i}) =n~var(XY)$ or $E(\sum_{i=1}^{n} a_{i} b_{i}) =n~E(XY)$. Does anyone have an idea on this?

• I think that the Matrix Cookbook will help you out here, specifically the section on General Statistics and Probability Commented Dec 11, 2017 at 17:13
• Are you familiar with properties of expectation? The relevant one is linearity. This is not a matrix problem--it requires only the most straightforward application of linearity.
– whuber
Commented Dec 11, 2017 at 17:14
• Thank you for your reply @whuber. I am familiar with properties of expectation more or less, but I was not sure that is correct: $var(\sum_{i=1}^{n} a_{i} b_{i})=E((\sum_{i=1}^{n} a_{i} b_{i})^{2})- (E(\sum_{i=1}^{n} a_{i} b_{i}))^{2} =n(E((XY)^{2})-(E(XY))^{2})$. It shouldn't be $n^{2} (E((XY)^{2})-(E(XY))^{2})$?
– Niki
Commented Dec 11, 2017 at 17:30
• I have provided proof here: github.com/BAI-Yeqi/Statistical-Properties-of-Dot-Product/blob/… :) Commented Nov 23, 2021 at 5:25
• a.b will be a scalar value. How does it make sense to get the mean and variance of a scalar? Sorry for dumb question... Commented Aug 21, 2023 at 3:47

\begin{aligned} E(\sum_{i=1}^{n} a_{i} b_{i}) &=\sum_{i=1}^{n}E( a_{i} b_{i}) \text{, due to linearity}\\ &= n E(XY) \text{ , due to i.i.d}\\ \end{aligned} Note that variance of sum of independent variables is equal to the sum of their variance. \begin{aligned} var(\sum_{i=1}^{n} a_{i} b_{i}) &=\sum_{i=1}^{n}var( a_{i} b_{i}) \\ &=n~var(XY) \text{, due to i.i.d}\\ \end{aligned}

Here $X,Y$ are independent are follows distribution $N(0,\sigma^2)$. You will have to use the property that $X$ and $Y$ are independent to evalute $E(XY)$ and $var(XY)$.

• How should be $var(\sum_{x} (\sum_{i} a_{x-i}b_{i} \cdot \sum_{i'} a_{x-i'}c_{i'}))$? this is not correct $n^{3}var(X^{2}YZ)$, am I right?
– Niki
Commented Dec 11, 2017 at 19:00
• where does $c$ come from? Commented Dec 11, 2017 at 19:09
• Oh,I forgot to write, $\textbf{c}, \textbf{a},\textbf{b}$ are independent random vectors. It is another equation that I want to know its variance.
– Niki
Commented Dec 11, 2017 at 19:36
• @SiongThyeGoh hey could you please explain the second step in expectation for which the reason is i.i.d ? Thanks Commented Jan 15, 2019 at 3:38
• $E(a_1b_1)=E(a_2b_2) = \ldots=E(a_nb_n)=E(XY)$, then we sum them up. Commented Jan 15, 2019 at 3:42