Search for probability and statistics terms on Statlect
StatLect

Vectors and matrices

by , PhD

This lecture provides an informal introduction to matrices and vectors.

Table of Contents

Matrix

A matrix is a two-dimensional array that has a fixed number of rows and columns and contains a number at the intersection of each row and column.

A matrix is usually delimited by square brackets.

Example Here is an example of a matrix having two rows and two columns:[eq1]

Dimension of a matrix

If a matrix has K rows and $L$ columns, we say that it has dimension $K	imes L$, or that it is a $K	imes L$ matrix.

Example The matrix[eq2]has $2$ rows and $3$ columns. So, we say that A is a $2	imes 3$ matrix.

Entries of a matrix

The numbers contained in a matrix are called entries of the matrix (or elements, or components).

If A is a matrix, the entry at the intersection of row k and column $l$ is usually denoted by $A_{k,l}$ (or $A_{kl}$). We say that it is the $left( k,l
ight) $-th entry of A.

Example Let A be a $3	imes 2$ matrix defined as follows:[eq3]The element of A at the intersection of the third row and the first column, that is, its $left( 3,1
ight) $-th entry is[eq4]

Vectors

If a matrix has only one row or only one column it is called a vector.

A matrix having only one row is called a row vector.

Example The $1	imes 3$ matrix[eq5]is a row vector because it has only one row.

A matrix having only one column is called a column vector.

Example The $2	imes 1$ matrix[eq6]is a column vector because it has only one column.

Scalars

A matrix having only one row and one column is called a scalar.

Example The $1	imes 1$ matrix[eq7]is a scalar. In other words, a scalar is a single number.

Equal matrices

Equality between matrices is defined in the obvious way.

Two $K	imes L$ matrices A and $B$ having the same dimension are said to be equal if and only if all their corresponding elements are equal to each other:[eq8]

Zero matrices

A matrix A is a zero matrix if all its elements are equal to zero, and we write [eq9]

Example If A is a $2	imes 3$ matrix and $A=0$, then[eq10]

Square matrices

A $K	imes L$ matrix is called a square matrix if the number of its rows is the same as the number of its columns, that is, $K=L$.

Example The $2	imes 2$ matrix[eq11]is a square matrix.

Example The $3	imes 3$ matrix[eq12]is a square matrix.

Diagonal and off-diagonal elements

Let A be a square matrix.

The diagonal (or main diagonal of A) is the set of all entries $A_{k,l}$ such that $k=l$.

The elements belonging to the diagonal are called diagonal elements, and all the other entries are called off-diagonal.

Example Let A be the $3	imes 3$ matrix defined by[eq13]All off-diagonal entries of A are equal to $3$, while the three diagonal elements are equal to $5$, $2,$, and 1, respectively.

Identity matrix

A square matrix is called an identity matrix if all its diagonal elements are equal to 1 and all its off-diagonal elements are equal to 0. It is usually indicated by the letter I.

Example The $3	imes 3$ matrix[eq14]is the $3	imes 3$ identity matrix.

Transpose of a matrix

If A is a $K	imes L$ matrix, its transpose, denoted by $A^{	op } $, is the $L	imes K$ matrix such that the $left( l,k
ight) $-th element of $A^{	op }$ is equal to the $left( k,l
ight) $-th element of A for any k and $l$ satisfying $1leq kleq K$ and $1leq lleq L$.

In other words, the columns of $A^{	op }$ are equal to the rows of A (equivalently, the rows of $A^{	op }$ are equal to the columns of A).

Example Let A be the $2	imes 3$ matrix defined by [eq15]Its transpose $A^{	op }$ is the following $3	imes 2$ matrix:[eq16]

Example Let A be the $2	imes 2$ matrix defined by [eq17]Its transpose $A^{	op }$ is the following $2	imes 2$ matrix:[eq18]

Symmetric matrices

A square matrix is said to be symmetric if it is equal to its transpose.

Example Let A be the $2	imes 2$ matrix defined by [eq19]Its transpose $A^{	op }$ is the following $2	imes 2$ matrix:[eq20]which is equal to A. Therefore, A is symmetric.

Solved exercises

Below you can find some exercises with explained solutions.

Exercise 1

Let A be a $3	imes 3$ matrix defined by[eq21]

Find its transpose.

Solution

The transpose $A^{	op }$ is a matrix such that its columns are equal to the rows of A:[eq22]

Exercise 2

Let A be a $3	imes 1$ column vector defined by[eq23]

Show that its transpose is a row vector.

Solution

The transpose $A^{	op }$ is a matrix such that its rows are equal to the columns of A. But A has only one column, which implies that $A^{	op }$ has only one row. Therefore, it is a row vector:[eq24]

Exercise 3

Let A be a $3	imes 3$ matrix defined by[eq25]

Is it symmetric?

Solution

A is symmetric if it is equal to its transpose. The transpose of A is[eq26]which is not equal to A. Therefore, A is not symmetric.

How to cite

Please cite as:

Taboga, Marco (2021). "Vectors and matrices", Lectures on matrix algebra. https://www.statlect.com/matrix-algebra/vectors-and-matrices.

The books

Most of the learning materials found on this website are now available in a traditional textbook format.