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]
⌘⏎ run · ⌘← → nav
▶ Output
Run your code to see output here.