Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download
Views: 52
Image: ubuntu2204
Kernel: SageMath 10.1

3D Coordinate

We use a tuple of three numbers to express a point in the 3D space as (x,y,z)(x,y,z). Note the right-hand rule for the three axis.

The distance between two points P1(x1,y1,z1)P_1(x_1,y_1,z_1) and P2(x2,y2,z2)P_2(x_2,y_2,z_2) is P1P2=(x2x1)2+(y1y2)2+(z1z2)2.|P_1P_2|=\sqrt{(x_2-x_1)^2+(y_1-y_2)^2+(z_1-z_2)^2}.

The Standard Equation for the Sphere of Radius aa and Center (x0,y0,z0)(x_0,y_0,z_0) is (xx0)2+(yy0)2+(zz0)2=a2.(x-x_0)^2+(y-y_0)^2+(z-z_0)^2=a^2.

Example

Find the center and radius of the sphere x2+y2+z2+3x4z+1=0.x^2+y^2+z^2+3x-4z+1=0.

Note that the equation is equivalent to (x+3/2)2+y2+(z2)2=9/4+41=21/4(x+3/2)^2 + y^2 + (z-2)^2 = 9/4 + 4 - 1 = 21/4

# Find the center and the radius of the ball. reset() var('x y z') p = implicit_plot3d(x^2 + y^2 + z^2 + 3*x - 4*z + 1 == 0, (x,-4,4), (y,-4,4), (z,-1,5), opacity = 0.3) center = vector([-3/2,0,2]) radius = sqrt(3 + (3/2)^2) p += point([center], size = 30, color = 'red') p += line([center, center + vector([radius, 0, 0])], size = 30, color = 'green') p += point([center + vector([radius, 0, 0])], size = 30, color = 'cyan') p.show() print('The center is', center, 'and the radius is', radius)
Graphics3d Object
The center is (-3/2, 0, 2) and the radius is 1/2*sqrt(21)
# The ball with center at origin and radius 2 reset() var('x y z') p = implicit_plot3d(x^2 + y^2 + z^2 == 4, (x,-3,3), (y,-3,3), (z,-3,3), opacity = 0.3, fill = true) p.show()
Graphics3d Object

Vector in 3D

Vectors represent things that have both magnitude and direction in the plane (2D) or in space (3D).

Vector/directed line segment represent quantities such as force, displacement, and velocity.

The vector represented by the directed line segment AB\overrightarrow{AB} has initial point AA and terminal point BB and its length is denoted by AB|\overrightarrow{AB}|. Two vectors are equal if they have the same length (magnitude) and direction.

Component Form

If v\vec{v} is a two-dimensional vector in the plane equal to the vector with initial point at the origin and terminal point (v1,v2)(v_1,v_2), then the component form of v\vec{v} is v=v1,v2.\vec{v}=\langle v_1,v_2\rangle.

If v\vec{v} is a three-dimensional vector in the space equal to the vector with initial point at the origin and terminal point (v1,v2,v3)(v_1,v_2,v_3), then the component form of v\vec{v} is v=v1,v2,v3.\vec{v}=\langle v_1,v_2,v_3\rangle.

Given the points P(x1,y1,z1)P(x_1,y_1,z_1) and Q(x2,y2,z2)Q(x_2,y_2,z_2), the component form of PQ\overrightarrow{PQ} is PQ=x2x1,y2y1,z2z1.\overrightarrow{PQ}=\langle x_2-x_1,y_2-y_1,z_2-z_1\rangle.

The magnitude or length of the vector v=PQ\vec{v}=\overrightarrow{PQ} is the nonnegative number v=v12+v22+v32=(x2x1)2+(y2y1)2+(z2z1)2.|\vec{v}|=\sqrt{v_1^2+v_2^2+v_3^2}=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}.

Vector Algebra Operations

Let u=u1,u2,u3\vec{u}=\langle u_1,u_2,u_3\rangle and v=v1,v2,v3\vec{v}=\langle v_1,v_2,v_3\rangle be vectors in space and kk is a scalar in RR.

  • u+v=u1+v1,u2+v2,u3+v3\vec{u}+\vec{v}=\langle u_1+v_1,u_2+v_2,u_3+v_3\rangle

  • Scalar multiplication: ku=ku1,ku2,ku3k\vec{u}=\langle ku_1,ku_2,ku_3\rangle

Midpoint of a Line Segment

The midpoint MM of the line segment joining points P(x1,y1,z1)P(x_1,y_1,z_1) to Q(x2,y2,z2)Q(x_2,y_2,z_2) is the point (x1+x22,y1+y22,z1+z22).\left({x_1+x_2\over 2},{y_1+y_2\over 2},{z_1+z_2\over 2}\right).

reset() origin2 = vector([0, 0]) u2 = vector([2, 1]) v2 = vector([1, 2]) p2 = arrow2d(origin2, u2, color = 'red', legend_label = 'u', legend_color = 'red') + text("u=%s"%(u2), u2, horizontal_alignment='left', vertical_alignment='bottom') p2 += arrow2d(origin2, v2, color = 'cyan', legend_label = 'v', legend_color = 'cyan') + text("v=%s"%(v2), v2, horizontal_alignment='left', vertical_alignment='bottom') p2 += arrow2d(origin2, u2+v2, color = 'green', legend_label = 'u+v', legend_color = 'green') + text("u+v=%s"%(u2+v2), u2+v2, horizontal_alignment='left', vertical_alignment='bottom') p2 += arrow2d(u2, u2+v2, color = 'cyan') p2 += arrow2d(v2, u2+v2, color = 'red') p2 += point2d(origin2, size=50, color='black') p2 += arrow2d(origin2, 2*u2+v2, color = 'purple', legend_label = '2u+v', legend_color = 'purple') + text("2u+v=%s"%(2*u2+v2), 2*u2+v2, horizontal_alignment='left', vertical_alignment='bottom') p2 += arrow2d(u2+v2, 2*u2+v2, color = 'red') p2 += arrow2d(v2, u2, color = 'black', legend_label = 'u-v', legend_color = 'black') p2.show()
Image in a Jupyter notebook

Properties of Vector Operations

Let u\vec{u}, v\vec{v}, w\vec{w} be vectors in plane or space and aa, bb are scalars.

  • u+v=v+u\vec{u}+\vec{v}=\vec{v}+\vec{u}

  • (u+v)+w=u+(v+w)(\vec{u}+\vec{v})+\vec{w}=\vec{u}+(\vec{v}+\vec{w})

  • u+0=0+u\vec{u}+\vec{0}=\vec{0}+\vec{u}

  • u+(u)=0\vec{u}+(-\vec{u})=\vec{0}

  • 0u=00\vec{u}=\vec{0}

  • 1u=u1\vec{u}=\vec{u}

  • a(bu)=(ab)ua(b\vec{u})=(ab)\vec{u}

  • a(u+v)=au+ava(\vec{u}+\vec{v})=a\vec{u}+a\vec{v}

  • (a+b)u=au+bu(a+b)\vec{u}=a\vec{u}+b\vec{u}

Unit Vectors/Direction

A vector v\vec{v} of length 1 is called a unit vector. The standard unit vectors are i=1,0,0, j=0,1,0, k=0,0,1.\vec{i}=\langle 1,0,0\rangle,~\vec{j}=\langle 0,1,0\rangle,~\vec{k}=\langle 0,0,1\rangle. For a vector in space, we have v=?i+?j+?k.\vec{v}={\color{red}?\quad}\vec{i}+{\color{red}?\quad}\vec{j}+{\color{red}?\quad}\vec{k}.

Find a unit vector u\vec{u} in the direction of the vector from P(1,0,1)P(1,0,1) to Q(3,2,0)Q(3,2,0).

First we find the vector form PP to QQ, which is v=31,20,01=2,2,1.\vec{v}=\langle 3-1, 2-0, 0-1\rangle=\langle 2, 2, -1\rangle. Then we normalize it by dividing by the length of the vector (v=22+22+(1)2=3|\vec{v}|=\sqrt{2^2+2^2+(-1)^2}=3) to get the unit vector vv=132,2,1=23,23,13.{\vec{v}\over |\vec{v}|}={1\over 3}\langle 2, 2, -1\rangle=\left\langle {2\over 3}, {2\over 3}, -{1\over 3}\right\rangle.

Length and Direction

If v0\vec{v}\neq \vec{0}, then

  • vv{\vec{v}\over |\vec{v}|} is the direction of v.\vec{v}.

  • the equation v=vvv\vec{v}=|\vec{v}|{\vec{v}\over |\vec{v}|} expresses v\vec{v} as its length times its direction.

The Dot Product

If a force F\vec{F} is applied to a particle moving along a straight path, we often need to know the magnitude of the force in the direction of motion. Note that the direction that is perpendicular to the path does not help moving the particle along the path, so we only need to find the part that is parallel to the path. If the angle between the force and the path direction is θ\theta, then only the magnitude Fcos(θ)|\vec{F}|\cos(\theta) works.

If v\vec{v} is parallel to the tangent line to the path at the point where F\vec{F} is applied, then we want the magnitude of F\vec{F} in the direction of v\vec{v}, which is Fcosθ|\vec{F}|\cos\theta where θ\theta is the angle between F\vec{F} and the v\vec{v}. The question is "how do we find the angle θ\theta?"

By the cosine rule, we have uv2=u2+v22uvcosθ.|\vec{u}-\vec{v}|^2=|\vec{u}|^2+|\vec{v}|^2-2|\vec{u}||\vec{v}|\cos\theta.

reset() u = vector([2, 1]) v = vector([1, 2]) print('The dot product of', u, 'and', v, 'is u*v =', u*v) print('u.dot_product(v) =', u.dot_product(v)) print('u.inner_product(v) =', u.inner_product(v)) print('|u|^2+|v|^2-|u-v|^2 = ', u*u + v*v - (u-v)*(u-v))
The dot product of (2, 1) and (1, 2) is u*v = 4 u.dot_product(v) = 4 u.inner_product(v) = 4 |u|^2+|v|^2-|u-v|^2 = 8

Inner product of u and v: u*v, u.dot_product(v), u.inner_product(v)

Norm of u: u.norm()

Angle Between Two Vectors

The dot product (inner product) uv\vec{u}\cdot\vec{v} of vectors u=u1,u2,u3\vec{u}=\langle u_1,u_2,u_3\rangle and v=v1,v2,v3\vec{v}=\langle v_1,v_2,v_3\rangle is the scalar uv=u1v1+u2v2+u3v3.\vec{u}\cdot\vec{v}={u_1v_1+u_2v_2+u_3v_3}.

So the cosine rule tells uv2=u2+v22uv=u2+v22uvcosθ.|\vec{u}-\vec{v}|^2= |\vec{u}|^2 + |\vec{v}|^2 - 2\vec{u}\cdot\vec{v}=|\vec{u}|^2 + |\vec{v}|^2 - 2|\vec{u}||\vec{v}|\cos\theta.

The angle θ\theta between two nonzero vectors u=u1,u2,u3\vec{u}=\langle u_1,u_2,u_3\rangle and v=v1,v2,v3\vec{v}=\langle v_1,v_2,v_3\rangle is given by θ=cos1(uvuv).\theta=\cos^{-1}\left({\vec{u}\cdot\vec{v}\over|\vec{u}||\vec{v}|}\right).

Example

Find the angle between u=i2j2k\vec{u}=\vec{i}-2\vec{j}-2\vec{k} and v=6i+3j+2k\vec{v}=6\vec{i}+3\vec{j}+2\vec{k}.

origin = vector([0, 0, 0]) u = vector([1, -2, -2]) v = vector([6, 3, 2]) uv = (u*v)/v.norm()^2*v print('The angle is', N(arccos(u*v/u.norm()/v.norm())/pi*180), 'degrees.') p = arrow3d(origin, u, color = 'red', legend_label = 'u', legend_color = 'red', aspect_ratio = 1) p += arrow3d(origin, v, color = 'cyan', legend_label = 'v', legend_color = 'cyan') p += arrow3d(u, uv, color = 'black') p += point3d(uv, size=50, color='black') p.show()
The angle is 100.980575427612 degrees.
Graphics3d Object

Find the angle θ\theta in the triangle ABCABC determined by the vertices A=(0,0), B=(3,5)A = (0, 0),~B = (3, 5), and C=(5,2)C = (5, 2).

We first compute the two vectors u:=CA=(05,02)=(5,2)\vec{u}:=CA = (0-5,0-2)=(-5,-2), and v:=CB=(35,52)=(2,3)\vec{v}:=CB=(3-5,5-2)=(-2,3). Then we compute the angle by the formule θ=cos1(uvuv).\theta=\cos^{-1}\left({\vec{u}\cdot\vec{v}\over|\vec{u}||\vec{v}|}\right).

A = vector([0, 0]) B = vector([3, 5]) C = vector([5, 2]) u = A - C v = B - C print('The angle is', N(arccos(u*v/u.norm()/v.norm())/pi*180), 'degrees.') p = arrow2d(C, A, color = 'red', legend_label = 'CA', legend_color = 'red', aspect_ratio = 1) + text("A", A, horizontal_alignment='right', vertical_alignment='bottom') p += arrow2d(C, B, color = 'cyan', legend_label = 'CB', legend_color = 'cyan') + text("B", B, horizontal_alignment='right', vertical_alignment='bottom') p += arrow2d(A, B, color = 'black') + text("C", C, horizontal_alignment='right', vertical_alignment='bottom') p.show()
The angle is 78.1113419603720 degrees.
Image in a Jupyter notebook

Orthogonal Vectors

Vectors u\vec{u} and v\vec{v} are orthogonal if uv=0\vec{u}\cdot\vec{v}=0.

Properties of the Dot Product

If u\vec{u}, v\vec{v}, and w\vec{w} are any vectors and cc is a scalar, then

  • uv=vu\vec{u}\cdot\vec{v}=\vec{v}\cdot\vec{u}

  • (cu)v=u(cv)=c(uv)(c\vec{u})\cdot\vec{v}=\vec{u}\cdot(c\vec{v})=c(\vec{u}\cdot\vec{v})

  • u(v+w)=uv+uw\vec{u}\cdot(\vec{v}+\vec{w})=\vec{u}\cdot\vec{v}+\vec{u}\cdot\vec{w}

  • uu=u2\vec{u}\cdot\vec{u}=|\vec{u}|^2

  • 0u=0\vec{0}\cdot\vec{u}=0

Projecting one Vector onto another

The vector projection of u\vec{u} onto v\vec{v} is the vector projvu=(ucosθ)vv\mbox{proj}_{\vec{v}}\vec{u}=(|\vec{u}|\cos\theta){\vec{v}\over |\vec{v}|} The scalar component of u\vec{u} in the direction of v\vec{v} is the scalar ucosθ=uvv=uvv|\vec{u}|\cos\theta = {\vec{u}\cdot\vec{v}\over |\vec{v}|}=\vec{u}\cdot{\vec{v}\over|\vec{v}|}

Therefore, the projection is projvu=uvv2v\mbox{proj}_{\vec{v}}\vec{u}={\vec{u}\cdot\vec{v}\over|\vec{v}|^2}{\vec{v}}

Verify that uprojvu\vec{u}-\mbox{proj}_{\vec{v}}\vec{u} is orthogonal to v\vec{v}.

(uprojvu)v=uvprojvuv=uvuvv2vv=0.(\vec{u}-\mbox{proj}_{\vec{v}}\vec{u})\cdot \vec{v}=\vec{u}\cdot\vec{v}-\mbox{proj}_{\vec{v}}\vec{u}\cdot \vec{v}=\vec{u}\cdot\vec{v}-{\vec{u}\cdot\vec{v}\over|\vec{v}|^2}{\vec{v}\cdot\vec{v}}=0.
reset() var('x y z') origin = vector([0, 0]) u = vector([2, 1]) v = vector([1, 1]) uv = (u*v)/v.norm()^2*v p = arrow2d(origin, u, color = 'red', legend_label = 'u', legend_color = 'red', aspect_ratio = 1) + text("u=%s"%(u), u, horizontal_alignment='left', vertical_alignment='bottom') p += arrow2d(origin, v, color = 'cyan', legend_label = 'v', legend_color = 'cyan') + text("v=%s"%(v), v, horizontal_alignment='left', vertical_alignment='bottom') p += arrow2d(u, uv, color = 'black') + text("$P_v(u)=%s$"%latex(uv), uv, horizontal_alignment='left', vertical_alignment='bottom') p += point2d(uv, size=50, color='black') p.show()
Image in a Jupyter notebook

The Cross Product

In a plane, we can use slope and angle of inclination to describe a line. How to describe a plane in space?

If u\vec{u} and v\vec{v} are not parallel, they determine a plane. We select a unit vector n\vec{n} perpendicular to the plane by the right-hand rule.

The cross/vector product u×v\vec{u}\times \vec{v} is the vector u×v=(uvsinθ)n.\vec{u}\times \vec{v}=(|\vec{u}||\vec{v}|\sin\theta)\vec{n}.

  • i×j=k=(j×i)\vec{i}\times\vec{j}=\vec{k}=-(\vec{j}\times \vec{i})

  • j×k=i=(k×j)\vec{j}\times\vec{k}=\vec{i} = -(\vec{k}\times \vec{j})

  • k×i=j=(i×k)\vec{k}\times \vec{i}=\vec{j}= -(\vec{i}\times \vec{k})

  • i×i=j×j=k×k=0\vec{i}\times \vec{i}=\vec{j}\times \vec{j}=\vec{k}\times \vec{k}=\vec{0}

Applications of the cross product:

  • compute area The magnitude of the cross product is the area of the parallelogram determined by u\vec{u} and v\vec{v}.

  • find perpendicular vector: u×v\vec{u}\times \vec{v} is perpendicular to u\vec{u} and v\vec{v}.

Nonzero vectors u\vec{u} and v\vec{v} are parallel if and only if u×v=0\vec{u}\times \vec{v}=\vec{0}

Some Properties of the Cross Product

If u\vec{u}, v\vec{v}, and w\vec{w} are any vectors and r, sr,~s are scalars, then

  • (ru)×(sv)=(rs)(u×v)(r\vec{u})\times(s\vec{v})=(rs)(\vec{u}\times\vec{v})

  • u×v=v×u\vec{u}\times \vec{v}=-\vec{v}\times \vec{u}

  • 0u=0\vec{0}\cdot\vec{u}=\vec{0}

  • u×(v+w)=u×v+u×w\vec{u}\times(\vec{v}+\vec{w})=\vec{u}\times\vec{v}+\vec{u}\times\vec{w}

  • (v+w)×u=v×u+w×u(\vec{v}+\vec{w})\times \vec{u}=\vec{v}\times\vec{u}+\vec{w}\times\vec{u}

  • u×(v×w)=(uw)v(uv)w\vec{u}\times (\vec{v}\times \vec{w}) = (\vec{u}\cdot\vec{w})\vec{v}-(\vec{u}\cdot\vec{v})\vec{w}

Determinant Formula for u×v\vec{u}\times \vec{v}

If u=u1,u2,u3\vec{u}=\langle u_1,u_2,u_3\rangle and v=v1,v2,v3\vec{v}=\langle v_1,v_2,v_3\rangle, then based on the properties of cross product, we have u×v=(u1i+u2j+u3k)×(v1i+v2j+v3k)=u1v2ku1v3ju2v1k+u2v3i+u3v1ju3v2i=ijku1u2u3v1v2v3\vec{u}\times\vec{v}=(u_1\vec{i}+u_2\vec{j}+u_3\vec{k})\times(v_1\vec{i}+v_2\vec{j}+v_3\vec{k})={\color{blue}u_1v_2\vec{k}}{\color{red}-u_1v_3\vec{j}}{\color{blue}-u_2v_1\vec{k}}+{\color{green}u_2v_3\vec{i}}+{\color{red}u_3v_1\vec{j}}{\color{green}-u_3v_2\vec{i}}=\begin{vmatrix} {\color{green}\vec{i}} & {\color{red}\vec{j}} & {\color{blue}\vec{k}}\\u_1&u_2 & u_3\\v_1&v_2&v_3 \end{vmatrix}

a=vector((2,3,0)) b=vector((1,0,1)) #Plot vectors a and b and their cross product all together plot(a,color="blue")+plot(b,color="red")+plot(a.cross_product(b),color="black")
Graphics3d Object

Triple Scalar or Box Product

(u×v)w=u×vwcosθ|(\vec{u}\times \vec{v})\cdot\vec{w}|=|\vec{u}\times \vec{v}||\vec{w}||\cos\theta|

It computes the volume of the parallelepiped determined by u\vec{u}, v\vec{v}, and w\vec{w}.

Calculating the Triple Scalar Product as a Determinant (u×v)w=((u1i+u2j+u3k)×(v1i+v2j+v3k))(w1i+w2j+w3k)=(u2v3u3v2)w1+(u3v1u1v3)w2+(u1v2u2v1)w3=w1w2w3u1u2u3v1v2v3=u1u2u3v1v2v3w1w2w3(\vec{u}\times\vec{v})\cdot\vec{w}=((u_1\vec{i}+u_2\vec{j}+u_3\vec{k})\times(v_1\vec{i}+v_2\vec{j}+v_3\vec{k}))\cdot(w_1\vec{i}+w_2\vec{j}+w_3\vec{k})={\color{green}(u_2v_3-u_3v_2)}w_1+{\color{red}(u_3v_1-u_1v_3)}w_2+{\color{blue}(u_1v_2-u_2v_1)}w_3=\begin{vmatrix}w_1&w_2&w_3\\ u_1&u_2 & u_3\\v_1&v_2&v_3 \end{vmatrix}=\begin{vmatrix} u_1&u_2 & u_3\\v_1&v_2&v_3\\w_1&w_2&w_3 \end{vmatrix}

(u×v)w=(v×w)u=(w×u)v(\vec{u}\times \vec{v})\cdot\vec{w}=(\vec{v}\times\vec{w})\cdot\vec{u}=(\vec{w}\times\vec{u})\cdot\vec{v}

Lines and Planes in Space

A vector equation for the line LL through P0(x0,y0,z0)P_0(x_0,y_0,z_0) parallel to v\vec{v} is r(t)=r0+tv,<t<,\vec{r}(t)=\vec{r}_0+t\vec{v},\qquad -\infty<t<\infty, where r0\vec{r}_0 is the position vector of P0P_0.

The standard parametrization of the line through P0(x0,y0,z0)P_0(x_0,y_0,z_0) parallel to v=v1i+v2j+v3k\vec{v}=v_1\vec{i}+v_2\vec{j}+v_3\vec{k} is x=x0+tv1,y=y0+tv2,z=z0+tv3,<t<.x=x_0+tv_1, \quad y = y_0+tv_2,\quad z=z_0+tv_3,\quad -\infty<t<\infty.

Example: Parametrize the line segment joining the points P(3,2,3)P(-3, 2, -3) and Q(1,1,4)Q(1,-1,4)

We need to find v\vec{v} based on the two points on the line. By calculation, the vector v\vec{v} is v=1(3),12,4(3)=4,3,7\vec{v}=\langle 1-(-3), -1-2, 4-(-3)\rangle =\langle 4, -3,7\rangle Then we have x=3+4t,y=23t,z=3+7t,0t1 x = -3 + 4t,\quad y = 2 - 3t,\quad z = -3 + 7t,\quad 0\leq t \leq1

#First declare some variables var('x,y,z,t') #We can name the line as a parametric 3D curve in the variable t line = parametric_plot3d((4*t-3,-3*t+2,7*t-3),(t,-1,1),color="red") #We also name a point point = point3d((-3,2,-3),color="black",size=100) #Now we list them to be plotted point+line
Graphics3d Object

Distance from a Point SS to a Line Through PP Parallel to v\vec{v}

The distance is from a point to a line is PSsinθ|PS|\sin\theta, which does not depend on the point PP.

Find the distance from the point S(1,1,5)S(1, 1, 5) to the line L:x=1+t, y=3t, z=2t.L: x = 1 + t,~y = 3 - t,~z = 2t.

reset() var('x y z') S = vector([1, 1, 5]) P = vector([2, 2, 2]) v = vector([1, -1, 2]) T = P + 2*v u = S-P uv = P+(u*v)/(v*v)*v p = arrow3d(P, S, color = 'red', legend_label = 'u', legend_color = 'red', aspect_ratio = 1) p += arrow3d(P, T, color = 'cyan', legend_label = 'v', legend_color = 'cyan') p += arrow3d(S, uv, color = 'black') p += point3d(uv, size=50, color='black') print('The distance is', (S-uv).norm()) print('We can use the cross product |PS x v|, which is', u.cross_product(v).norm()/v.norm()) p.show()
The distance is sqrt(5) We can use the cross product |PS x v|, which is 1/6*sqrt(30)*sqrt(6)
Graphics3d Object

An Equation for a Plane in Space

A plane is determined by a point on the plane and its "tilt" or orientation.

The plane through P0(x0,y0,z0)P_0(x_0,y_0,z_0) normal to n=Ai+Bj+Ck=A,B,C\vec{n}=A\vec{i}+B\vec{j}+C\vec{k}=\langle A,B,C\rangle has

  • Vector equation: nP0P=0\vec{n}\cdot\vec{P_0P}=0

  • Component equation: A(xx0)+B(yy0)+C(zz0)=0A(x-x_0)+B(y-y_0)+C(z-z_0)=0

  • Component equation simplified: Ax+By+Cz=Ax0+By0+Cz0Ax+By+Cz = Ax_0+By_0+Cz_0

Example: Find an equation for the plane through A(0,0,1)A(0,0,1), B(2,0,0)B(2,0,0), and C(0,3,0)C(0,3,0).

We need to find the normal vector first use the cross product of AB=2ik\vec{AB}= 2\vec{i}-\vec{k} and AC=3jk\vec{AC}=3\vec{j}-\vec{k}. The cross product is AB×AC=3i+2j+6k\vec{AB}\times \vec{AC}=3\vec{i}+2\vec{j}+6\vec{k}. Therefore, the equation is 3x+2y+6z=6.3x+2y+6z = 6.

Lines of Intersection

Two planes that are not parallel intersect in a line.

This is perpendicular to both normal vectors, so we can use the cross product to find the direction of the line.

Example: Find parametric equations for the line of intersection of the planes 3x6y2z=153x - 6y - 2z = 15 and 2x+y2z=5.2x + y - 2z = 5.

We first compute the direction of the line using the cross product of two normal vectors, which gives 14i+2j+15k.14\vec{i}+2\vec{j}+15\vec{k}. Then we find one point on both planes, x=3,y=1,z=0x=3,y=-1,z=0.

reset() var('x y z t') n1 = vector([3, -6, -2]) n2 = vector([2, 1, -2]) v = n1.cross_product(n2) print('The direction of the line is ', v) P0 = vector([3,-1,0]) p = implicit_plot3d(3*x-6*y-2*z == 15, (x,-3,3), (y,-3,3), (z,-3,3), opacity = 0.3, fill = true) p += implicit_plot3d(2*x+y-2*z == 5, (x,-3,3), (y,-3,3), (z,-3,3), opacity = 0.3, fill = true, color = 'red') p += parametric_plot3d(P0 + t*v, (t,-0.3,0.1)) p.show()
The direction of the line is (14, 2, 15)
Graphics3d Object

Example: Find the point where the line x=83+2t,y=2t,z=1+tx={8\over 3}+2t,\quad y=-2t,\quad z=1+t intersects the plane 3x+2y+6z=63x + 2y + 6z = 6.

Just plug in to the equation of the plan and solve for tt.

#First declare some variables var('x,y,z,t') #We can name the line as a parametric 3D curve in the variable t line = parametric_plot3d((2*t+8/3,-2*t,t+1),(t,-1.5,0),color="red") #We can name the plane as an implicit 3D plot (contour surface) in the variables x,y,z plane = implicit_plot3d(3*x+2*y+6*z==6, (x,0,2), (y,0,3), (z,-1,1),opacity=0.5) #We also name a point intersect = point3d((2/3,2,0),color="black",size=15) #Now we list them to be plotted intersect+line+plane
Graphics3d Object

Distance from a Point to a Plane

The distance from a point to a plane is the inner product of PS\vec{PS} to the normalized normal vector nn{\vec{n}\over|\vec{n}|}.

reset() var('x y z t') S = vector([1, 1, 3]) v = vector([3,2,6]) P0 = vector([0,0,1]) PS = S-P0 t0 = PS.inner_product(v/v.norm()) print("The distance is ", t0) p = implicit_plot3d(3*x+2*y+6*z == 6, (x,-3,5), (y,-3,5), (z,-3,3), opacity = 1, fill = true) p += parametric_plot3d(P0 + t*v, (t,0,0.5), size =50) p += arrow3d(P0, S, color = 'red', legend_label = 'u', legend_color = 'red', aspect_ratio = 1) p += point3d(P0 + t0*v/v.norm(), size=50, color='black') p += arrow3d(P0 + t0*v/v.norm(), S, color = 'blue') p.show()
The distance is 17/7
Graphics3d Object

Angles Between Planes

The angle between planes is the angle between two normal vectors.