[next] [prev] [prev-tail] [tail] [up]
Problem: Solve for x given that \(A x=b\) where
and
These 2 equations represent 2 straight lines in a 2D space. An exact solution exist if the 2 lines intersect at a point. The 2 lines are \(x+2y=5\) and \(x+3y=8\).
Mathematica
Remove["Global`*"]; ContourPlot[{x+2y==5,x+3y==8}, {x,-3,2}, {y,1.5,4}, ContourStyle->{{Red,Thickness[0.01]}, {Blue,Thickness[0.01]}}, GridLines->Automatic, GridLinesStyle->Dashed, ImageSize->300]
mat = {{1,2},{1,3}}; b = {5,8}; x = LinearSolve[mat,b]
{-1,3}
Matlab
A = [1 2;1 3]; b = [5;8]; x = A\b
x = -1 3
[next] [prev] [prev-tail] [front] [up]