# Need to rewrite linear combination as vector expression.

1. Feb 6, 2012

### devonho

1. The problem statement, all variables and given/known data
Given vectors
${\bf r}=\left[r_1,r_2,r_3\ldots{}r_n\right]^T$
${\bf e}=\left[e_1,e_2,e_3\ldots{}e_n\right]^T$

I need to write the sum

$\sum_{i=1}^{n}r_ie_i^2$

in terms of ${\bf r}$ and ${\bf e}$

2. Relevant equations
Nil.

3. The attempt at a solution

Without $r_i$, I am able to write $\sum_{i=1}^{n}e_i^2$ as

$\sum_{i=1}^{n}e_i^2={\bf e}^T{\bf e}$

If $r_i$ can be independant of $i$ I should be able to move it out of the summation. I am looking for some expansion/reexpression of $r_i$.

2. Feb 7, 2012

### tiny-tim

hi devonho!
why??

(i don't think you can)

3. Feb 14, 2012

### devonho

This seems to work:

${\bf r}= \left[ \begin{array}{ccccc} r_1 & 0 & \ldots & & 0\\ 0 & r_2 & & & \vdots \\ \vdots & & r_3 & & \\ & & & \ddots & \\ 0 & \ldots & & & r_n \\ \end{array} \right]$

${\bf e}= \left[ \begin{array}{c} e_1 \\ e_2 \\ \vdots\\ e_n \\ \end{array} \right]$

${\bf e}^T{\bf re}=\left[ e_1, e_2 \ldots e_n\right] \left[ \begin{array}{ccccc} r_1 & 0 & \ldots & & 0\\ 0 & r_2 & & & \vdots \\ \vdots & & r_3 & & \\ & & & \ddots & \\ 0 & \ldots & & & r_n \\ \end{array} \right] \left[ \begin{array}{c} e_1 \\ e_2 \\ \vdots\\ e_n \\ \end{array} \right] =r_1e_1^2+r_2e_2^2\ldots +r_ne_n^2 =\sum_{i=1}^{n}r_ie_i^2$

4. Feb 14, 2012

### tiny-tim

but devonho, how do you form that middle matrix out of the vector r ?