0 / 34
Lesson 22

Solving Linear Systems

Solve Ax = b:

A = np.array([[2,1],[1,3]])
b = np.array([5, 7])
x = np.linalg.solve(A, b)
Why this matters

linalg.solve is the numerically preferred path to x when A is square and non-singular: same answer as inv(A) @ b in theory, but faster and stabler in floating point.

Least squares (lstsq) extends the idea when equations outnumber unknownsβ€”common in fitting.

ResourcesDocs, references & more β€” opens in a new tab
🎯 Your Task

Solve 3x+2y=18, x+4y=22.

A = [[3,2],[1,4]], b = [18, 22]
exercise.py
⌘⏎ run Β· βŒ˜β† β†’ nav
β–Ά Output
Run your code to see output here.