3: MATRIX Operations (2024)

  1. Last updated
  2. Save as PDF
  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}}}\)

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

    \( \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{\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}\)


    MATLAB serves as a powerful tool to solve matrices. To use matrices as a tool to solve equations or represent data a fundamental understanding of what a matrix is and how to compute arithmetical operations with it is critical.

    What is a Matrix?

    A matrix is a rectangular array or grid of values which arranged in rows and columns. Matrices are used to operate on a set of numbers with variations of traditional mathematical operations. Matrices serve valuable rolls within many engineering and mathematic tasks due to their useful ability to effectively store and organize information. Understanding matrices proves valuable when trying to solve systems of equations, organizing data collected during experiments, computing mathematical operations on large quantities of numbers, and complicated applications in linear algebra, machine learning, and optimization.

    When describing matrices, we will name them based on the number of rows and columns. For example, the following matrix is a 2×3 matrix as it has two rows and three columns.


    And this matrix is a 4×3 matrix:


    Matrix Arithmetic

    Matrices are an effective way to modify an entire set of numbers in one operation. Simple ways to modify matrices include addition, subtraction, multiplication, and division by a scalar, or individual number. When completing these operations, complete the calculation with each number in the matrix, as denoted below.

    \[\left[\begin{matrix}1&2\\4&3\\\end{matrix}\right]+2=\left[\begin{matrix}1+2&2+2\\4+2&3+2\\\end{matrix}\right]=\left[\begin{matrix}3&4\\6&5\\\end{matrix}\right]\gets Answer\]

    \[\left[\begin{matrix}2&-4\\1.5&3\\\end{matrix}\right]\ast3=\left[\begin{matrix}2\ast3&-4\ast3\\1.5\ast3&3\ast3\\\end{matrix}\right]=\left[\begin{matrix}6&-12\\4.5&9\\\end{matrix}\right]\gets Answer\]

    Matrices with the same dimensions (i.e. two 2×2 matrices) can have more mathematical operations completed with them. For example, you can add or subtract matrices with the same dimensions by completing operations on the values in each corresponding location in a matrix. The following shows a template for adding or subtracting two matrices.


    Multiplying matrices is more difficult than adding and subtracting and does not follow the format listed above. The process known as element-wise matrix multiplication is shown below. This process for multiplying matrices is a fundamental concept of linear algebra and occurs when working with matrices in MATLAB. Be aware of the general form shown below and that it can be extrapolated to include matrices of different sizes. An alternative method of multiplying two matrices that are the same size is called component-wise multiplication, which would follow the same form as the matrix addition shown above. The procedure for coding these into MATLAB are shown below.

    Vectors and Matrices in MATLAB

    Inputting Matrices

    It is easy to input matrices into MATLAB scripts. To make a standard matrix in the command window, use the following format with values of a matrix listed with spaces between each value. Use a semicolon to separate each line of the matrix. To see how this process looks within MATLAB, refer to the examples at the end of this section.

    >> [1 2 3;4 5 6;7 8 9]

    Which produces 3: MATRIX Operations (1) in MATLAB.

    Note that to create an array list each number in a row separated only by spaces. To move down to a new row, use a semicolon. To save time making a large array, a colon can be used to “list” numbers. For example, 1:5 would create a row containing 1, 2, 3, 4, and 5. For example,

    >> [1:3;4:6;7:9]

    creates the same matrix as the first example. If you would like to create a matrix that counts by a unit other than one, add a second colon that denotes what numbers will be included. For example,

    >> [2:2:10;12:2:20]

    will create the following 2 row by 5 column matrix which counts by twos between 2 and 10 in the top row and 12 and 20 in the bottom row

    Matrix Operations and Concatenating Matrices


    1) Enter the following matrix efficiently into MATLAB.


    2) Enter the following matrix efficiently into MATLAB.


    3) Use the following matrices in the following parts.


    3a) Input the above matrices into MATLAB. Assign each the variable name shown.

    Note that by placing semicolons at the end of the line the output is suppressed. As a result, the actual matrices are not printed in the code, which saves space in this instance.


    3b) Add matrix 3: MATRIX Operations (2) and 3: MATRIX Operations (3) to each other.


    3c) Subtract matrix 3: MATRIX Operations (4) from matrix 3: MATRIX Operations (5).


    3d) Multiply matrix 3: MATRIX Operations (6) and matrix 3: MATRIX Operations (7) using component-wise multiplication.





    Efficiently type the following matrices into MATLAB’s command window.

    1. 3: MATRIX Operations (8)
    1. 3: MATRIX Operations (9)
    1. 3: MATRIX Operations (10)
    1. 3: MATRIX Operations (11)

    Use these matrices to complete the following computations using MATLAB.

    \[a=\left[\begin{matrix}-8&4\\5&12\\\end{matrix}\right];\ \ b=\left[\begin{matrix}3&5\\2&3\\\end{matrix}\right];\ \ c=\left[\begin{matrix}-2&1.5\\12&-4.25\\\end{matrix}\right];\ \ d=\left[\begin{matrix}-2&0\\2&4\\\end{matrix}\right]\]

    1. 3: MATRIX Operations (12)
    1. 3: MATRIX Operations (13)
    1. 3: MATRIX Operations (14)
    1. 3: MATRIX Operations (15)
    3: MATRIX Operations (2024)


    3: MATRIX Operations? ›

    These operations help us solve a number of problems with matrices, and they can be very useful. There are three basic matrix row operations that we need to cover: Switching rows, multiplying a row by a number, and adding rows.

    What are the three methods in matrix? ›

    There are three types of matrix row operations: interchanging 2 rows, multiplying a row, and adding/subtracting a row with another. Each notation for this is different, and is displayed in the note section.

    What are the basic matrix operations? ›

    Matrix operations mainly include four basic algebraic operations namely, the addition of matrices, subtraction of matrices, and multiplication of matrices and division of matrices. We all know that Matrix is an array of numbers or expressions arranged in rows (horizontal array) and columns (vertical array).

    How to do 3 matrices? ›

    Associativity: Matrix multiplication is associative. Given three matrices A, B and C, such that the products (AB)C and A(BC) are defined, then (AB)C = A(BC).

    What does order 3 matrix mean? ›

    A matrix of order 3 contains three rows and three columns, which means its order is 3×3.

    What are the three matrix operations? ›

    These operations help us solve a number of problems with matrices, and they can be very useful. There are three basic matrix row operations that we need to cover: Switching rows, multiplying a row by a number, and adding rows.

    What are the standard matrix operations? ›

    Matrix Operations
    • Matrix Multiplication. A key matrix operation is that of multiplication. ...
    • Matrix Addition. The sum of two matrices. ...
    • Matrix Subtraction. ...
    • Other Element-by-element Operations. ...
    • Matrix Inversion. ...
    • Solving Simultaneous Linear Equations. ...
    • The Transpose of a Matrix. ...
    • Multiple Operations.

    What is the rule of matrix operation? ›

    To perform matrix multiplication, the first matrix must have the same number of columns as the second matrix has rows. The number of rows of the resulting matrix equals the number of rows of the first matrix, and the number of columns of the resulting matrix equals the number of columns of the second matrix.

    What is the order of matrix operations? ›

    We can see that the order of matrix operations involving these operations is analogous to that of real number operations, which is often known as PEMDAS (parentheses, exponents, multiplication, division, addition, subtraction).

    What is 3 into 3 matrix? ›

    A 3 by 3 matrix includes 3 rows and 3 columns. Elements of the matrix are the numbers that form the matrix. A single matrix is one whose determinant is not equivalent to zero. For each x x x square matrix, there exists an inverse of each matrix.

    What is the rule for 3 by 3 matrix? ›

    To evaluate the determinant of a 3 × 3 matrix we choose any row or column of the matrix - this will contain three elements. We then find three products by multiplying each element in the row or column we have chosen by its cofactor. Finally, we sum these three products to find the value of the determinant.

    How to identify a matrix? ›

    A matrix is a rectangular arrangement of numbers into rows and columns. The dimensions of a matrix tell the number of rows and columns of the matrix in that order. Since matrix ‍ has ‍ rows and ‍ columns, it is called a 2 × 3 ‍ matrix.

    What is a simple definition of a matrix? ›

    A matrix is a rectangular arrangement of a collection of numbers into a fixed number of rows and columns. When the elements are arranged in a matrix horizontally, it forms the rows of a matrix. When the elements are arranged in a matrix vertically, it forms the columns of a matrix.

    What does 3 mean in the matrix? ›

    In the Matrix films, Morpheus, Neo, and Trinity form their own trinity, as do Agents Smith, Brown, and Jones. Three ships' crews, another trinity, try to access the door of the Source: Soren's, Niobe's, and Morpheus's. The reappearance of the number three perpetuates and emphasizes the idea of the trinity.

    What are the methods used in matrix? ›

    Matrix and computer methods

    There are two general approaches to the matrix analysis of structures: the stiffness matrix method and the flexibility matrix method. The stiffness matrix method is the customary method utilized in computer programs for the solution of building structures.

    What are the methods of matrix equation? ›

    Q: What are the methods used to solve a matrix equation?
    • Gaussian Elimination: This method involves using elementary row operations to convert the matrix into its row echelon form or reduced row echelon form. ...
    • Cramer's Rule: ...
    • Matrix Inversion: ...
    • LU Decomposition: ...
    • Iterative Methods:

    What are the mathematical methods for matrix? ›

    Now matrix subtraction is expressible as a matrix addition operation A − B = A + (−B) = A + (−1 × B) There are two matrix identity elements: one for addition, 0, and one for multiplication, I. Multiplication, AB, is only well defined if the number of columns of A = the number of rows of B.


    Top Articles
    Latest Posts
    Article information

    Author: Rob Wisoky

    Last Updated:

    Views: 6426

    Rating: 4.8 / 5 (48 voted)

    Reviews: 95% of readers found this page helpful

    Author information

    Name: Rob Wisoky

    Birthday: 1994-09-30

    Address: 5789 Michel Vista, West Domenic, OR 80464-9452

    Phone: +97313824072371

    Job: Education Orchestrator

    Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building

    Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.