Three Applications
> with(linalg):
1) Find an equation of the plane containing the 3 points (1,2,3), (0,1,0), (-1,0,1).
Solution: Consider Ax+By+Cz=D. Plugging in the points gives 3 equations in four unknowns.
>
A:=matrix([
[ 1, 2, 3,-1],
[ 0, 1, 0,-1],
[-1, 0, 1,-1] ]);
> b:=vector([0,0,0]);
> linsolve(A,b);
If we let t=1 we get A=-1, B=1, C=0 and D=1, or -x+y=1, as an equation for our plane.
Exercise 1: FInd an equation for the plane going through (1,1,1), (2,0,2), (3,3,1).
2) Find the cubic polynomial that passes through the points (1,0), (3,2), (4,1), and (5,-1).
Solution: Consider ax^3 + bx^2 + cx + d = y. Get 4 equations and 4 unknowns.
>
A:=matrix([
[ 1, 1, 1, 1 ],
[ 27, 9, 3, 1 ],
[ 64, 16, 4, 1 ],
[125, 25, 5, 1 ] ]);
> b:=vector([0,2,1,-1]);
> c:=linsolve(A,b);
Next we plot the solution along with the data points.
> p1:=plot(c[1]*x^3+c[2]*x^2+c[3]*x+c[4],x=0..6):
> p2:=plot({[1,0],[3,2],[4,1],[5,-1]},style=point,color=blue,symbol=circle):
> plots[display]({p1,p2});
Exercise 2: Find and plot the fourth degree polynomial determined by these five points: (-2,0), (-1,-1), (0,3), (1,-1), (2,1).
3) Find the circle that passes through three given points in the plane. Let's start with the three points
(0,0), (1,1) and (2,1). Recall the equation of a circle: (x-h)^2 + (y-k)^2 = r^2. Then we get three equations in three unknowns. But these equations are nonlinear. We expand them and regard h^2, k^2 and r^2 as unknowns. this gives 3 equations and 5 unknowns.
>
A:=matrix([
[0,0,1,1,-1],
[-2,-2,1,1,-1],
[-4,-2,1,1,-1]]);
> b:=vector([0,-2,-5]);
> linsolve(A,b);
Now we can read off the center point and compute the radius using the distance to any of the given
three points.
> sqrt((0-3/2)^2+(0+1/2)^2);
> evalf(");
Homework Problem: Does this always work? Prove your claims. Hint: Study rref(A) for different input points. Do you see a pattern? (See also the drawcircle.mws worksheet.)