2.1 Objetos

2.1.1 Escalar

\(x = \boldsymbol{x}_{1 \times 1} = x_i\)

2.1.2 Vetor coluna

\(\boldsymbol{x} = \boldsymbol{x}_{n \times 1} = \begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix}\)

2.1.3 Vetor linha

\(\boldsymbol{x}' = \boldsymbol{x}_{1 \times n} = \big[ x_1, x_2, \ldots, x_n \big] = \begin{bmatrix} x_1 & x_2 & \cdots & x_n \end{bmatrix}\)

2.1.4 Matriz

\(X = X_{n \times p} = \begin{bmatrix} x_{1,1} & x_{1,2} & \cdots & x_{1,p} \\ x_{2,1} & x_{2,2} & \cdots & x_{2,p} \\ \vdots & \ddots & \cdots & \vdots \\ x_{n,1} & x_{n,2} & \cdots & x_{n,p} \end{bmatrix}\)

A matriz é quadrada quando \(n=p\).

2.1.5 Matriz identidade (de ordem \(n\))

\(I_{n} = I_{n \times n} = \begin{bmatrix} 1 & 0 & 0 & \cdots & 0 \\ 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 1 \end{bmatrix}\)
diag(4)
##      [,1] [,2] [,3] [,4]
## [1,]    1    0    0    0
## [2,]    0    1    0    0
## [3,]    0    0    1    0
## [4,]    0    0    0    1
dim(diag(4))
## [1] 4 4

2.1.6 Matriz diagonal

Valores fora da diagonal principal iguais a zero.

\(\begin{bmatrix} x_{1,1} & 0 & \cdots & 0 \\ 0 & x_{2,2} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & x_{n,n} \end{bmatrix} \equiv \boldsymbol{x}' I_n\)
1:4 * diag(4)
##      [,1] [,2] [,3] [,4]
## [1,]    1    0    0    0
## [2,]    0    2    0    0
## [3,]    0    0    3    0
## [4,]    0    0    0    4
diag(1:4)
##      [,1] [,2] [,3] [,4]
## [1,]    1    0    0    0
## [2,]    0    2    0    0
## [3,]    0    0    3    0
## [4,]    0    0    0    4

2.1.7 Matrizes triangulares

A matriz triangular inferior possui valores acima da diagonal principal iguais a zero.

\(\begin{bmatrix} x_{1,1} & 0 & 0 & \cdots & 0 \\ x_{2,1} & x_{2,2} & 0 & \cdots & 0 \\ x_{3,1} & x_{3,2} & x_{3,3} & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & 0 \\ x_{n,1} & x_{n,2} & x_{n,3} & \cdots & x_{n,n} \end{bmatrix}\)

A matriz triangular superior possui valores abaixo da diagonal principal iguais a zero.

\(\begin{bmatrix} x_{1,1} & x_{1,2} & x_{1,3} & \cdots & x_{1,n} \\ 0 & x_{2,2} & x_{2,3} & \cdots & x_{2,n} \\ 0 & 0 & x_{3,3} & \cdots & x_{3,n} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & x_{n,n} \end{bmatrix}\)

Exercício 2.2 Veja a documentação das funções lower.tri e upper.tri. Como pode-se obter apenas os elementos da parte triangular inferior e superior de uma matriz? Dê um exemplo.

2.1.8 Matriz simétrica

Ocorre em uma matriz quadrada quando \(a_{ij}=a_{ji}\)

# matriz diagonal
(X <- diag(4:1))
##      [,1] [,2] [,3] [,4]
## [1,]    4    0    0    0
## [2,]    0    3    0    0
## [3,]    0    0    2    0
## [4,]    0    0    0    1
isSymmetric(X)
## [1] TRUE
# adicionando elemntos não nulos em posições simétricas
X[2,1] <- X[1,2] <- -3
X[4,2] <- X[2,4] <- 7
X
##      [,1] [,2] [,3] [,4]
## [1,]    4   -3    0    0
## [2,]   -3    3    0    7
## [3,]    0    0    2    0
## [4,]    0    7    0    1
isSymmetric(X)
## [1] TRUE