# Method Efficient Computing normal of surface R^3

A idea efficiency computational the problem solve the normals of surface in point $P = (x_i,y_i,z_i)$. My thought to solution in way will be compute tangent plane to surface by partial derivative and gradients vector that generate the plane, being $\vec{u}$ and $\vec{v}$ with inner product $\vec{u} \times \vec{v}$.
What other ways possible?

thanks.

• How is the surface given? As a parameterization or as an equation? – Arthur Sep 8 '15 at 15:06
• A form equation $f(x,y)=z$ – Peter Hausdorff Smith K. Sep 8 '15 at 15:11
• If I write the equation, if possible, in parametric form I spend less steps to calculates it? One of my doubts. – Peter Hausdorff Smith K. Sep 8 '15 at 15:14
• If your surface is given by $\sin x+y=z$, then you rewrite it to the equation $\sin x+y-z=0$. A normal vector in any point is given by the gradient of the lefthand side at that point. – Arthur Sep 8 '15 at 16:04
• @Arthur: you should craft that into an Answer. – hardmath Sep 8 '15 at 17:09

For instance, you could have the graph of a function, which would have the equation $z = f(x, y)$. That can be rearranged into $f(x, y) - z = 0$, and here we can take the gradient of the lefthand side. That gives the vector $$\nabla (f(x, y) - z) = \left(\frac{\partial f}{\partial x}(x, y), \frac{\partial f}{\partial y}(x, y), -1\right)$$ which, if you insert an $x$ and $y$ value gives you the normal vector for the surface at that point.
Another example, where your surface is not the graph of a function (at least not a priori) would be the sphere $x^2 + y^2 + z^2 -1 = 0$. We take the gradient, and get $(2x, 2y, 2z)$. If you insert the $x, y$ and $z$ values of a point on the sphere into that vector, it gives you a normal vector at that point.
Now, if your surface (named $\sigma$, say) is given by a parametrization, it usually looks either like this: $$\sigma :\cases{x(u, v)= \ldots\\y(u, v)= \ldots\\z(u, v)= \ldots}$$ or like this: $$\sigma(u, v) = (x(u, v), y(u, v), z(u, v))$$ For instance, you can parametrize the sphere by $$\sigma(u, v) = (\sin v\cos u, \sin v\sin u, \cos v) \qquad 0\leq u \leq 2\pi, 0 \leq v \leq \pi$$ In this case, to get the normal vector at a point $p$ (given by $u = u_0, v = v_0$), you do it by vector cross product. The two vectors $\vec u, \vec v$ you cross are (almost always) given by $$\vec u = \frac{\partial \sigma}{\partial u}(u_0, v_0),\quad \vec v = \frac{\partial \sigma}{\partial v}(u_0, v_0)$$ In the case of the sphere, this gives us $$\vec u = (-\sin v_0\sin u_0, \sin v_0 \cos u_0, 0),\quad\vec v = (\cos v_0\cos u_0, \cos v_0 \sin u_0, -\sin u_0)$$ which works nicely, except for the north and south poles, where $\vec u$ turns out to be $0$ (since $v_0$ is $0$ for the north pole and $\pi$ for the south), and $\vec v$ has a whole spectrum of different values (since $u_0$ can be whatever you want it to be and you will still be at the respective poles). So there you need to figure out something else.
• Note that in the first case discussed, $z = f (x,y)$, the gradient of $F(x,y,z) = f(x,y) - z$ never vanishes. Thus the potential difficulty mentioned at the end of the Answer is avoided in the "one variable a smooth function of the others" setting. – hardmath Sep 8 '15 at 20:40