Surface Normal, Tangent Plane

This is a worked out example from Paul’s online notes, can be found here. https://tutorial.math.lamar.edu/Classes/CalcIII/ParametricSurfaces.aspx

A surface is made of points in 3D space, and points are vectors of coordinates \(\{x,y,z\}\). We need 3 separate functions to define a point vector in 3D space. The \(u\), \(v\) are function inputs, they are called parameters depending on the model. \(\bar r=\{u,2v^2,u^2+v\}\) \[x=u\] \[y=2v^2\] \[z=u^2+v\] At the point \(\{2,2,3\}\), \(u=2\) \(v=-1\). \[2=2\] \[2=2(-1)^2\] \[3=2^2+(-1)\]

library(Deriv)
## Warning: package 'Deriv' was built under R version 4.0.5
#rbar
x="u"
y="2*v^2"
z="u^2+v"

Tangent vectors are partial derivatives \(\bar r\) w.r.t \(u\) and \(v\). \[\partial \bar r/\partial u=\{\partial x/\partial u,\partial y/ \partial u, \partial z/ \partial u\}\]

\[\partial \bar r/\partial v=\{\partial x/\partial v,\partial y/ \partial v, \partial z/ \partial v\}\]

#dr/du
x.u=Deriv(x,"u")
y.u=Deriv(y,"u")
z.u=Deriv(z,"u")

#dr/dv
x.v=Deriv(x,"v")
y.v=Deriv(y,"v")
z.v=Deriv(z,"v")

c(x.u,y.u,z.u)
## [1] "1"     "0"     "2 * u"
c(x.v,y.v,z.v)
## [1] "0"     "4 * v" "1"

For determinant, we use \(|\times|\) notation. We have the \(\times\) notation for cross product in this example. Cross product of the 2 partial derivatives is the surface normal, it is also a vector. \[\frac{\partial \bar r}{\partial u} \times \frac{\partial \bar r}{\partial v}=\{j_1,j_2,j_3\}\]

\[j_1=\left| {\begin{array} *{\frac{\partial y}{\partial u}}&{\frac{\partial y}{\partial v}}\\ {\frac{\partial z}{\partial u}}&{\frac{\partial z}{\partial v}} \end{array}} \right|\] \[j_2=\left| {\begin{array} *{\frac{\partial z}{\partial u}}&{\frac{\partial z}{\partial v}}\\ {\frac{\partial x}{\partial u}}&{\frac{\partial x}{\partial v}} \end{array}} \right|\] \[j_3=\left| {\begin{array} *{\frac{\partial x}{\partial u}}&{\frac{\partial x}{\partial v}}\\ {\frac{\partial y}{\partial u}}&{\frac{\partial y}{\partial v}} \end{array}} \right|\]

j1=paste0(y.u,"*",z.v,"-",y.v,"*",z.u)
j2=paste0(z.u,"*",x.v,"-",z.v,"*",x.u)
j3=paste0(x.u,"*",y.v,"-",x.v,"*",y.u)

j1=Simplify(j1)
j2=Simplify(j2)
j3=Simplify(j3)

c(j1,j2,j3)
## [1] "-(8 * (u * v))" "-1"             "4 * v"

We have computed normal vector, by inputting parameters \(u=2\), \(v=-1\) we can get the normal vector at the point \(x=2\), \(y=2\), \(z=3\). \(n=\{16,-1,-4\}\).

u=2
v=-1

normal_x<-function(u,v) eval(parse(text=j1)) 
normal_y<-function(u,v) eval(parse(text=j2)) 
normal_z<-function(u,v) eval(parse(text=j3))
 
n1=normal_x(2,-1)
n2=normal_y(2,-1)
n3=normal_z(2,-1)
c(n1,n2,n3)
## [1] 16 -1 -4

Here is also the tangent plane.

tangent_plane <- 
 paste0(n1,"*(x-2)+",n2,"*(y-2)+",n3,"*(z-3)=0")

Simplify(tangent_plane)
## [1] "16 * (x - 2) + 2 - (4 * (z - 3) + y) = 0"