Una matriz \(A\) es un conjunto de vectores filas y vectores columnas la cual tiene una dimesión o tamaño de acuerdo al número de filas y número de columnas. \[n\times m\] \[A=(a_{ij})_{n \times m}\] \[\begin{equation} A=\begin{pmatrix} 2 & 5 & 0\\ 7 & 3 & 8\\ 3 & 0 & 1 \end{pmatrix}_{3 \times 3} \end{equation}\]
A<-matrix(c(2,5,0,7,3,8,3,0,1),nrow=3,ncol=3,byrow=TRUE)
A
## [,1] [,2] [,3]
## [1,] 2 5 0
## [2,] 7 3 8
## [3,] 3 0 1
\[\begin{equation} B=\begin{pmatrix} 1 & 2 & 3\\ 7 & 3 & -1\\ 3 & -2 & 1 \end{pmatrix}_{3 \times 3} \end{equation}\]
B<-matrix(c(1,2,3,7,3,-1,3,-2,1),nrow=3,ncol=3,byrow=TRUE)
B
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 7 3 -1
## [3,] 3 -2 1
Las suma se realiza componente a componente de matrices cuadradas \[A+B=\begin{equation} \begin{pmatrix} 2 & 5 & 0\\ 7 & 3 & 8\\ 3 & 0 & 1 \end{pmatrix}_{3 \times 3} + \begin{pmatrix} 1 & 2 & 3\\ 7 & 3 & -1\\ 3 & -2 & 1 \end{pmatrix}_{3 \times 3} \end{equation}\]
A+B
## [,1] [,2] [,3]
## [1,] 3 7 3
## [2,] 14 6 7
## [3,] 6 -2 2
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.