var('x y z')
plane = implicit_plot3d(
y == x,
(x, -2, 2), (y, -2, 2), (z, -2, 2),
)
cylinder = implicit_plot3d(
x^2 + y^2 == 1,
(x, -2, 2), (y, -2, 2), (z, -2, 2),
color = 'red', opacity = 0.5
)
show(plane + cylinder)10 Three-Dimensional Space and Vectors
SageMath Spotlight
- Plotting 3D Surfaces (Section 2.4)
plot_3d(f, (x, xmin, xmax), (y, ymin, ymax))implicit_plot3d(f, (x, xmin, xmax), (y, ymin, ymax), (z, zmin, zmax))- Important options:
color='red'andopacity=0.5
- Defining and Plotting Vectors:
v = vector([1, 2, 3])w = vector([4, 5, 6])- Basic algebra:
v + w,3 * v - Plotting:
arrow3d((0,0,0), v, color='red')
10.1 Three-Dimensional Coordinate Systems
To build more sophisticated models of our physical world, we need to move beyond the \(xy\)-plane into higher-dimensional space: we start with the three-dimensional spatial world, denoted \(\mathbb{R}^3\), where we can rely on a mix of physical intuition and low-dimensional miracles. To do this, we will introduce a third axis, the \(z\)-axis, perpendicular to both the \(x\)- and \(y\)-axes. Note, however, that there are two ways that we could do so! To ensure we all agree on directions, we orient using the Right-Hand Rule:
The Right Hand Rule (Stewart et al. 2020, 12.1, pp. 830)
Here are two equivalent versions of the rule, both of which rely on the use of our right hand (the left hand will give the exact wrong answer). We can pick the one that works best for us!
- Pointing our fingers in the direction of the positive \(x\)-axis and curling them toward the positive \(y\)-axis, our thumb points along the positive \(z\)-axis.
- Pointing our index finger straight along the positive \(x\)-axis and our middle finger perpendicular to it along the positive \(y\)-axis, our thumb, again, points in the positive \(z\)-direction.
Every point in space is now represented by an ordered triple: \((x, y, z)\). Just as the \(x\)- and \(y\)-axes divide the plane into four quadrants, the \(xy\)-, \(yz\)-, and \(xz\)-coordinate planes divide 3D space into eight octants. We can project any point \((x,y,z)\) onto these planes by dropping the irrelevant coordinate (e.g., its projection onto the \(xy\)-plane is \((x, y, 0)\)) (Stewart et al. 2020, 12.1, pp. 831).
Surfaces and Curves
In \(\mathbb{R}^2\), a single equation like \(y = x\) or \(x^2 + y^2 = 1\) describes a 1-dimensional curve (a line and a circle, respectively). What do these equations describe in \(\mathbb{R}^3\)?
Because \(z\) is absent from the equation, \(z\) can be anything without changing the truth value of \(x^2+y^2=1\). Indeed, the circle \(x^2 + y^2 = 1\) is drawn in the \(xy\)-plane, and then stretched infinitely up and down the \(z\)-axis. The result is a 2-dimensional surface—specifically, a cylinder!
Rule of Thumb
Given a system of equations in some number of variables, we expect each equation to drop the dimension of the resulting geometric object by \(1\).
- In the plane, one equation cuts out a curve.
- In 3D space, one equation cuts out a surface.
- To isolate a curve, we need the intersection of two equations.
For example, the circle in the \(xy\)-plane requires two equations: \(x^2 + y^2 = 1\) and \(z = 0\).
Distance and Spheres
The familiar distance formula in \(\mathbb{R}^2\) extends naturally to \(\mathbb{R}^3\) via a double application of the Pythagorean theorem. The distance between points \(P(x_1, y_1, z_1)\) and \(Q(x_2, y_2, z_2)\) is: \[ \vert{}PQ\vert{} = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 + (z_2-z_1)^2}. \]
By definition, a sphere is the set of all points \((x,y,z)\) that lie at a constant distance \(r\) (the radius) from a fixed center point \((h,k,l)\). Squaring both sides of the distance formula gives the standard equation of a sphere (Stewart et al. 2020, 12.1, pp. 833): \[ (x-h)^2 + (y-k)^2 + (z-l)^2 = r^2. \]
A Gallery of Quadric Surfaces
Just as conic sections (ellipses, parabolas, hyperbolas) are curves defined by degree-two equations in \(\mathbb{R}^2\), quadric surfaces (Stewart et al. 2020, 12.6, pp. 876) are the 3D surfaces defined by degree-two equations in three variables. These are the most important examples to recognize:
- Spheres and Ellipsoids: If we distort a sphere \(x^2 + y^2 + z^2 = r^2\) by scaling the axes differently, we get an ellipsoid: \[ \frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} = 1, \] where \(a\), \(b\), and \(c\) are the principal semi-axes.
- Hyperbolic Paraboloid (aka the Saddle): The surface \(z = x^2 - y^2\) curls upward in the \(x\)-direction and downward in the \(y\)-direction. This will be a very important example in our units on optimization!
- Paraboloids and Cones: The paraboloid (\(z = x^2 + y^2\)) is the standard bowl shape. The cone (\(z^2 = x^2 + y^2\)) grows linearly outward from the origin rather than quadratically.
- Cylinders: As we saw earlier, equations missing a variable form cylinders. We can have elliptic cylinders (\(x^2+y^2=1\) or \(x^2 + \frac{y^2}{4} = 1\)) and hyperbolic cylinders (\(x^2 - y^2 = 1\)).
- Hyperboloids: These come in a one-sheeted (\(x^2 + y^2 - z^2 = 1\)) and two-sheeted variety (\(x^2 + y^2 - z^2 = -1\)).
var('x y z')
ellipsoid = implicit_plot3d(x^2/2^2 + y^2/3^2 + z^2 == 1, (x,-3,3), (y,-3,3), (z,-3,3), color='blue')
saddle = plot3d(x^2 - y^2, (x,-2,2), (y,-2,2), color='red', opacity=0.8)
cone = implicit_plot3d(z^2 == x^2 + y^2, (x,-2,2), (y,-2,2), (z,-2,2), color='green', opacity=0.8)
paraboloid = implicit_plot3d(z == x^2 + y^2, (x,-2,2), (y,-2,2), (z,-2,2), color='purple')
elliptical_cylinder = implicit_plot3d(x^2 + y^2 == 1, (x,-2,2), (y,-2,2), (z,-2,2), color='aqua')
hyperbolic_cylinder = implicit_plot3d(x^2 - y^2 == 1, (x,-2,2), (y,-2,2), (z,-2,2), color='yellow', opacity=0.8)
one_sheet_hyperboloid = implicit_plot3d(x^2 + y^2 - z^2 == 1, (x,-2,2), (y,-2,2), (z,-2,2), color='orange', opacity=0.5)
two_sheet_hyperboloid = implicit_plot3d(x^2 + y^2 - z^2 == -1, (x,-2,2), (y,-2,2), (z,-2,2), color='magenta')
show(ellipsoid)
show(saddle)
show(cone + paraboloid)
show(elliptical_cylinder + hyperbolic_cylinder)
show(one_sheet_hyperboloid + two_sheet_hyperboloid)