Skip to main content
Statistics LibreTexts

20.1: Matrix Basics

  • Page ID
    57809
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \(\newcommand{\longvect}{\overrightarrow}\)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    At its core, a matrix is a simple but powerful rectangular array of numbers, symbols, or expressions, arranged in rows and columns. Think of it as a structured data table or a digital spreadsheet, where each individual item within the grid is called an element. We typically define a matrix by its dimensions — the number of rows followed by the number of columns. These arrays are far more than just organizational tools; they are the fundamental language for representing and performing linear transformations and data.

    ✦•················• ✦ •··················•✦

    A matrix is just a rectangular array of scalars. It is used to simplify many mathematical calculations. Throughout this book, I will use it in such a sense. The following is an example of a matrix:

    \begin{equation}
    \mathbf{A} = \left[ \begin{matrix} 3 & 5 & 2 \\ a & 1 & 18 \end{matrix} \right]
    \end{equation}

    Because a matrix is a rectangular array, it has a dimension. The matrix \(\mathbf{A}\) above has dimension \(2 \times 3\) because there are 2 rows and 3 columns. We could also write this as

    \begin{equation}
    \mathbf{A} \in \mathcal{M}_{2 \times 3}
    \end{equation}

    This can be read in a few ways:

    • "\(\mathbf{A}\) is a \(2 \times 3\) matrix"
    • "\(\mathbf{A}\) is a matrix with dimension \(2 \times 3\)"
    • "\(\mathbf{A}\) is an element of the set of \(2 \times 3\) matrices"

    As an aside, note that the symbol \(\in\) means "is an element of" and \(\mathcal{M}_{2 \times 3}\) is "the set of all matrices of dimension \(2 \times 3\)."

    Also note that the dimension order is very important and is always written as rows \(\times\) columns. \(\mathcal{M}_{2 \times 3}\) and \(\mathcal{M}_{3 \times 2}\) are entirely different sets of matrices.

    A matrix is square if the number of rows equals the number of columns. That is, \(\mathbf{B}\) is square if

    \begin{equation}
    \mathbf{B} \in \mathcal{M}_{n \times n}
    \end{equation}

    for some number \(n \in \). If a matrix is square, the set is often denoted simply by \(\mathcal{M}_{n}\). The matrix \(\mathbf{A}\) above is not square because the number of rows does not equal the number of columns.

    Representation

    The next sections cover the algebra of matrices. To ease the notation, let me show you two ways of representing matrices. First, here is matrix \mathbf{A} written out.

    \begin{equation}
    \mathbf{A} = \left[ \begin{matrix}
    a_{1,1} & a_{1,2} & a_{1,3} & \cdots & a_{1,c} \\
    a_{2,1} & a_{2,2} & a_{2,3} & \cdots & a_{2,c} \\
    a_{3,1} & a_{3,2} & a_{3,3} & \cdots & a_{3,c} \\
    \vdots & \vdots & \vdots & \ddots & \vdots \\
    a_{r,1} & a_{r,2} & a_{r,3} & \cdots & a_{r,c} \\
    \end{matrix} \right]
    \end{equation}

    Note that every element in the \(\mathbf{A}\) matrix is represented by a lowercase \(a\) and its \(r,c\) position in the matrix. This allows us to simplify representation at times:
    \begin{equation}
    \mathbf{A} = \left[ a_{ij}\right]
    \end{equation}
    Here, \(i\) is the row index and \(j\) the column index.

    Now, with these two representations, we can enter the realm of the algebra of matrices.


    This page titled 20.1: Matrix Basics is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Ole Forsberg.

    • Was this article helpful?