Get Started »

# Matrices & Linear Algebra

The Wolfram Language represents matrices as lists of lists:

 In[1]:= ⨯ `{{1, 2}, {3, 4}}`

Enter a table using CTRL+ ENTER for rows and CTRL+ , for columns:

 In[2]:= ⨯ ```{ {a, b}, {c, d} }```
 Out[2]=

MatrixForm displays output as a matrix:

 In[3]:= ⨯ `MatrixForm[{{a, b}, {c, d}}]`
 Out[3]=

You can construct a matrix with iterative functions:

 In[1]:= ⨯ `Table[x + y, {x, 1, 3}, {y, 0, 2}]`
 Out[1]=

Or import data that represents a matrix:

 In[2]:= ⨯ `Import["data.csv"]`
 Out[2]=

IdentityMatrix, DiagonalMatrix and others are built-in symbols.

Standard matrix operations work elementwise:

 In[1]:= ⨯ `{1, 2, 3} {a, b, c}`
 Out[1]=

Compute the dot product of two matrices:

 In[2]:= ⨯ `{{1, 2}, {3, 4}}.{{a, b}, {c, d}}`
 Out[2]=

Find the determinant:

 In[3]:= ⨯ `Det[{{a, b}, {c, d}}]`
 Out[3]=

Get the inverse of a matrix:

 In[4]:= ⨯ `Inverse[{{1, 1}, {0, 1}}]`
 Out[4]=

Use LinearSolve to solve a linear system:

 In[1]:= ⨯ `LinearSolve[{{1, 1}, {0, 1}}, {x, y}]`
 Out[1]=

Functions for minimization and matrix decomposition are available as well.

QUICK REFERENCE: Matrices and Linear Algebra `»`