GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — javascript-algorithms/src/algorithms/math/matrix at master · codameio/javascript-algorithms

Expand file tree

/

matrix

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

matrix

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
__tests__
__tests__
 
 
Matrix.js
Matrix.js
 
 
README.md
README.md
 
 

README.md

Outline

Matrices

In mathematics, a matrix (plural matrices) is a rectangular array or table of numbers, symbols, or expressions, arranged in rows and columns. For example, the dimension of the matrix below is 2 × 3 (read "two by three"), because there are two rows and three columns:

| 1  9 -13 |
| 20 5 -6  |

An m × n matrix

An m × n matrix: the m rows are horizontal, and the n columns are vertical. Each element of a matrix is often denoted by a variable with two subscripts. For example, a2,1 represents the element at the second row and first column of the matrix

Operations on matrices

Addition

To add two matrices: add the numbers in the matching positions:

Matrices addition

The two matrices must be the same size, i.e. the rows must match in size, and the columns must match in size.

Subtracting

To subtract two matrices: subtract the numbers in the matching positions:

Matrices subtraction

Multiply by a Constant

We can multiply a matrix by a constant (the value 2 in this case):

Matrices multiplication be a constant

Multiplying by Another Matrix

To multiply a matrix by another matrix we need to do the dot product of rows and columns.

To work out the answer for the 1st row and 1st column:

Matrices multiplication - 1st step

Here it is for the 1st row and 2nd column:

Matrices multiplication - 2st step

If we'll do the same for the rest of the rows and columns we'll get the following resulting matrix:

Matrices multiplication - Result

Transposing

To "transpose" a matrix, swap the rows and columns.

We put a "T" in the top right-hand corner to mean transpose:

Transposing

References

  • Matrices on MathIsFun
  • Matrix on Wikipedia
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.