Solving Equations
A linear system
Ax = b is solved with the backslash operator, not by computing an inverse by hand:
A = [2, 1; 1, 3];
b = [3; 5];
x = A \ b;
disp(x)
A single nonlinear equation
f = @(x) x^2 - 2;
root = fzero(f, 1);
disp(root)
@(x) ... defines an anonymous function on the spot; fzero searches for a root near your starting guess (here, 1) -- this finds sqrt(2) numerically.
Why This Matters for Your Exams
A \ b is both more accurate and far faster than computing inv(A) * b by hand for anything bigger than 2x2 -- use it as the default, and only reach for inv() when a question specifically asks for the inverse itself.

