MATLAB matrices, solves, and eigenpairs

MATLAB treats the shape of a matrix as part of the problem. Build arrays with the intended dimensions, use a system-solving command for coupled equations, and check the result against the original equations. For results from eig, match each vector to its own value before interpreting it.

Build and solve a system

Within square brackets, spaces or commas separate columns, while semicolons start new rows. Thus A = [2 1; 1 3] has two rows and two columns, and b = [4; 7] is a two-entry column vector. Check size(A) and size(b) first: the row count of A must match that of b for A*x = b.


The command x = A\b uses left division to solve the system without explicitly forming inv(A). Verify the output with the residual r = A*x - b and inspect norm(r). If A is singular or poorly conditioned, inspect MATLAB diagnostics too: a small residual alone does not establish a unique, accurate solution.

Interpret eigenpairs

For a square matrix, [V,D] = eig(A) places each eigenvalue on the diagonal of D and its corresponding eigenvector in the same-indexed column of V.


The eigenpair relation is Avj=λjvjA v_j = \lambda_j v_j, so check A*V against V*D, allowing for floating-point error. Output order is not promised, and a nonzero multiple of an eigenvector represents the same direction.

Worked example

Take A = [2 1; 1 3] and b = [4; 7]. Solving x = A\b gives x = [1; 2]: the first row gives 2(1)+2=42(1)+2=4, and the second gives 1+3(2)=71+3(2)=7. Consequently A*x - b = [0; 0] in exact arithmetic. Since the determinant is 2(3)−1(1)=52(3)-1(1)=5, this square system has a unique solution.



A = [3 1; 2 4] and b = [7; 10] should represent a 2-by-2 system A*x = b. Which MATLAB snippet defines these arrays and computes x using a system solve?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

In MATLAB, A=[2 1;1 2]; b=[5;4]; x=A\b. Which column vector should x contain?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

For a square real matrix A, MATLAB returns [V,D]=eig(A). Which statement correctly describes how to use the output?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors