Arrays
Arrays
Arrays
SUMPRODUCT
Definition
For matrices A and B,
and
Sumproduct(A,
B)
Notes:
r = i and c = j. In other words, the two matrices must have the same
number of rows as each other and the same number of columns as
each other.
They do not need to be square matrices (where r = c and i = j).
Algebra geeks sometimes call this operation the “dot product” (to
distinguish it from matrix multiplication — described later in this
document), and symbolize it as .
Example
and
Sumproduct(A,
B)
Excel Method
A B C D
1 7 4 6
2 5 2 11
3
4 9 3 8
5 10 12 1
6 =SUMPRODUCT(A1:C2,A4:C5)
7 208
8
Example
and
Notes:
It is conventional to describe the shape of a matrix by listing the
number of rows first, and the number of columns second. Matrix A
above is an r x c matrix, and matrix B is an i x j matrix.
In this operation, it is necessary for c = i. However it is not necessary
for r = j. In other words, B must have the same number of rows as A
has columns, but it is not necessary for B to have the same number of
columns as A has rows.
The product AB will always be an r x j matrix.
Example
and
Note:
Not all square matrices can be inverted, a fact that has implications for
regression analysis.
Example
If
Then
Because
=0.14*0.333+0.11*0.667+0.1
0*0.000
=0.120
The portfolio weights are decision variables in this problem; if these change,
then of course the expected return on the portfolio would also change.
In cell B20, the MMULT and TRANSPOSE functions are combined to calculate
the variance of the portfolio.
For notational purposes, let’s define two matrices:
(3)
(4)
(5)
(6)
(7)
(8)
This calculation is usually presented in the form of step (6) in introductory
statistics classes, so as to avoid frightening people with the more general
matrix notation.