Addition and Subtraction of Matrices

Let (mathbf{A}) and (mathbf{B}) be matrices with dimensions (ntimes k). Use (a_{ij}) and (b_{ij}) to denote the numbers in the (i)th row and (j)th column of (mathbf{A}) and (mathbf{B}), respectively. Then, the matrix ( mathbf{C}=mathbf{A}+mathbf{B}) is defined to be the matrix with ( (a_{ij}+b_{ij})) in the (i)th row and (j)th column. Similarly, the matrix ( mathbf{C}=mathbf{A}-mathbf{B}) is defined to be the matrix with ( (a_{ij}-b_{ij})) in the (i)th row and (j)th column. Symbolically, we write this as the following.
begin{equation*} text{If }mathbf{A=}left( a_{ij}right) _{ij}text{ and } mathbf{B=}left( b_{ij}right) _{ij}text{, then} end{equation*}
begin{equation*} mathbf{C}=mathbf{A}+mathbf{B=}left( a_{ij}+b_{ij}right) _{ij}text{ and }mathbf{C}=mathbf{A}-mathbf{B=}left( a_{ij}-b_{ij}right) _{ij}. end{equation*} For example, consider
begin{equation*} mathbf{A}=left( begin{array}{cc} 2 & 5 \ 4 & 1 end{array} right) text{ }mathbf{B}=left( begin{array}{cc} 4 & 6 \ 8 & 1 end{array} right). end{equation*} Then begin{equation*} mathbf{A}+mathbf{B}=left( begin{array}{cc} 6 & 11 \ 12 & 2 end{array} right) text{ }mathbf{A}-mathbf{B}=left( begin{array}{cc} -2 & -1 \ -4 & 0 end{array} right) . end{equation*}

Basic Linear Regression Example of Addition and Subtraction. Now, recall that the basic linear regression model can be written as (n) equations:
begin{equation*} begin{array}{c} y_1=beta_0+beta_1x_1+varepsilon _1 \ vdots \ y_n=beta_0+beta_1x_n+varepsilon _n. end{array} end{equation*} We can define
begin{equation*} mathbf{y}=left( begin{array}{c} y_1 \ vdots \ y_n end{array} right) text{ }boldsymbol varepsilon =left( begin{array}{c} varepsilon _1 \ vdots \ varepsilon _n end{array} right) text{ and }mathrm{E~}mathbf{y} =left( begin{array}{c} beta_0+beta_1x_1 \ vdots \ beta_0+beta_1x_n end{array} right) . end{equation*} With this notation, we can express the (n) equations more compactly as ( mathbf{y=mathrm{E~}mathbf{y}+}boldsymbol varepsilon .)

[raw] [/raw]