Projecting onto a plane versus projecting onto a line
Suppose we have a plane, a line lying in that plane, and a point not lying in the plane. To make things even easier, assume that the plane and the line both pass through the origin of so that they are subspaces.
The process for finding a projection has to be done carefully because it is possible for the projection onto the plane and the projection onto the line to be different.
I will make an example and plot it.
Let's begin with the basic set-up: the plane, the line, and the point.
Now I will use Sage to compute and then plot the projection of b onto the line. Note that the arrow from b to its projection is perpendicular to the line, but not to the plane.
Now we shall compute and plot the projection of b onto the plane. Note that this gives a different point! This time, the arrow from b to its projection is perpendicular to the plane, but it doesn't even touch the line.
I didn't intend for that purple arrow to show up in this plot. I don't know why it is there. Perhaps this is a bug?