Skip to content

Mathematica Linear Algebra Basics

约 210 字小于 1 分钟

Mathematica

2025-09-14

Mathematica Symbolic Matrix and Vector Operations

Mathematica is very strong at symbolic matrix and vector operations. Let us go through the basics step by step.

1. Define vectors and matrices

In Mathematica:

  • A vector is a list.
  • A matrix is a list of lists.
v = {x, y, z}
A = {{a, b}, {c, d}}

You can inspect dimensions with Dimensions:

Dimensions[v]
Dimensions[A]

2. Matrix operations

  • Transpose
Transpose[A]
  • Matrix multiplication uses the dot operator .
A.v
A.A
  • Hadamard product
A*B

For linear algebra operations, do not use * in place of ..

  • Determinant and inverse
Det[A]
Inverse[A]
  • Identity matrix
IdentityMatrix[3]

3. Symbolic linear algebra

Mathematica can also handle symbolic linear algebra:

  • Eigenvalues and eigenvectors
Eigenvalues[A]
Eigenvectors[A]
  • Characteristic polynomial
CharacteristicPolynomial[A, λ]
  • Solve a linear system Ax=bAx=b
Solve[A.{x1, x2} == {1, 0}, {x1, x2}]

4. Basic vector operations

For symbolic vectors:

  • Dot product
Dot[v, v]
v.v
  • Cross product
Cross[{x1, x2, x3}, {y1, y2, y3}]
  • Norm
Norm[v]

5. Better output formatting

You can use MatrixForm to display matrices more clearly:

A // MatrixForm
贡献者: Junyuan He