{{Short description|Line or vector perpendicular to a curve or a surface}} {{redirect|Normal vector|vector spaces equipped with a generalization of magnitude|Normed vector space}}

thumb|A polygon and its two normal vectors|alt= right|thumb|A normal to a surface at a point is the same as a normal to the tangent plane to the surface at the same point. [[File:Tangent and normal to a curve.svg|thumb|Tangent and normal to a curve in a Cartesian coordinate system.]]

In geometry, a '''normal''' is an object (e.g. a line, ray, or vector) that is perpendicular to a given object. For example, the '''normal line''' to a plane curve at a given point is the infinite straight line perpendicular to the tangent line to the curve at the point.

A '''normal vector''' is a vector perpendicular to a given object at a particular point. A normal vector of length one is called a '''unit normal vector''' or '''normal direction'''. A curvature vector is a normal vector whose length is the curvature of the object. Multiplying a normal vector by {{val|-1}} results in the opposite vector, which may be used for indicating sides (e.g., interior or exterior) or orientation (e.g., clockwise vs. counterclockwise, right handed vs. left handed).

In three-dimensional space, a '''surface normal''', or simply '''normal''', to a surface at point {{math|''P''}} is a vector perpendicular to the tangent plane of the surface at {{math|''P''}}. The vector field of normal directions to a surface is known as ''Gauss map''. The word "normal" is also used as an adjective: a line ''normal'' to a plane, the ''normal'' component of a force, etc. The concept of normality generalizes to orthogonality (right angles).

The concept has been generalized to differentiable manifolds of arbitrary dimension embedded in a Euclidean space. The '''normal vector space''' or '''normal space''' of a manifold at point <math>P</math> is the set of vectors which are orthogonal to the tangent space at <math>P.</math> Normal vectors are of special interest in the case of smooth curves and smooth surfaces.

The normal is often used in 3D computer graphics (notice the singular, as only one normal will be defined) to determine a surface's orientation toward a light source for flat shading, or the orientation of each of the surface's corners (vertices) to mimic a curved surface with Phong shading.

{{anchor|Foot}}The '''foot''' of a normal at a point of interest ''Q'' (analogous to the foot of a perpendicular) can be defined at the point ''P'' on the surface where the normal vector contains ''Q''. The ''normal distance'' of a point ''Q'' to a curve or to a surface is the Euclidean distance between ''Q'' and its foot ''P''.

==Normal to space curves== {{main|Frenet–Serret formulas}} {{further|Curvature vector}} thumb|left|Normal direction (in red) to a curve (in black).

The normal direction to a space curve is: :<math> \mathbf{N} = R \frac{\mathrm{d} \mathbf{T} }{ \mathrm{d} s } </math> where <math> R = \kappa^{-1}</math> is the radius of curvature (reciprocal curvature); <math>\mathbf{T}</math> is the tangent vector, in terms of the curve position <math>\mathbf{r}</math> and arc-length <math>s</math>: :<math> \mathbf{T} = \frac{\mathrm{d} \mathbf{r} }{ \mathrm{d} s } </math>

==Normal to planes and polygons== thumb|Plane equation in normal form

For a convex polygon (such as a triangle), a surface normal can be calculated as the vector cross product of two (non-parallel) edges of the polygon.

For a plane given by the general form plane equation <math>ax + by + cz + d = 0,</math> the vector <math>\mathbf n = (a, b, c)</math> is a normal.

For a plane whose equation is given in parametric form <math display=block>\mathbf{r}(s,t) = \mathbf{r}_0 + s \mathbf{p} + t \mathbf{q},</math> where <math>\mathbf{r}_0</math> is a point on the plane and <math>\mathbf{p}, \mathbf{q}</math> are non-parallel vectors pointing along the plane, a normal to the plane is a vector normal to both <math>\mathbf{p}</math> and <math>\mathbf{q},</math> which can be found as the cross product <math>\mathbf{n}=\mathbf{p}\times\mathbf{q}.</math>

==Normal to general surfaces in 3D space== thumb|upright=1.4|A curved surface showing the unit normal vectors (blue arrows) to the surface

If a (possibly non-flat) surface <math>S</math> in 3D space <math>\R^3</math> is parameterized by a system of curvilinear coordinates <math>\mathbf{r}(s, t) = (x(s, t), y(s, t), z(s, t)),</math> with <math>s</math> and <math>t</math> real variables, then a normal to ''S'' is by definition a normal to a tangent plane, given by the cross product of the partial derivatives <math display=block>\mathbf{n}=\frac{\partial \mathbf{r}}{\partial s} \times \frac{\partial \mathbf{r}}{\partial t}.</math>

If a surface <math>S</math> is given implicitly as the set of points <math>(x, y, z)</math> satisfying <math>F(x, y, z) = 0,</math> then a normal at a point <math>(x, y, z)</math> on the surface is given by the gradient <math display=block>\mathbf{n} = \nabla F(x, y, z).</math> since the gradient at any point is perpendicular to the level set of <math>S.</math>

For a surface <math>S</math> in <math>\R^3</math> given as the graph of a function <math>z = f(x, y),</math> an upward-pointing normal can be found either from the parametrization <math>\mathbf{r}(x,y)=(x,y,f(x,y)),</math> giving <math display=block>\mathbf{n} = \frac{\partial \mathbf{r}}{\partial x} \times \frac{\partial \mathbf{r}}{\partial y} = \left(1,0,\tfrac{\partial f}{\partial x}\right) \times \left(0,1,\tfrac{\partial f}{\partial y}\right) = \left(-\tfrac{\partial f}{\partial x}, -\tfrac{\partial f}{\partial y},1\right);</math> or more simply from its implicit form <math>F(x, y, z) = z-f(x,y) = 0,</math> giving <math>\mathbf{n} = \nabla F(x, y, z) = \left(-\tfrac{\partial f}{\partial x}, -\tfrac{\partial f}{\partial y}, 1 \right).</math> Since a surface does not have a tangent plane at a singular point, it has no well-defined normal at that point: for example, the vertex of a cone. In general, it is possible to define a normal almost everywhere for a surface that is Lipschitz continuous.

===Orientation=== right|thumb|300px|A vector field of normals to a surface The normal to a (hyper)surface is usually scaled to have unit length, but it does not have a unique direction, since its opposite is also a unit normal. For a surface which is the topological boundary of a set in three dimensions, one can distinguish between two '''normal orientations''', the '''inward-pointing normal''' and '''outer-pointing normal'''. For an oriented surface, the normal is usually determined by the right-hand rule or its analog in higher dimensions.

If the normal is constructed as the cross product of tangent vectors (as described in the text above), it is a pseudovector.

===Transforming normals=== {{hatnote|in this section we only use the upper <math>3 \times 3</math> matrix, as translation is irrelevant to the calculation}}

When applying a transform to a surface it is often useful to derive normals for the resulting surface from the original normals.

Specifically, given a 3×3 transformation matrix <math>\mathbf{M},</math> we can determine the matrix <math>\mathbf{W}</math> that transforms a vector <math>\mathbf{n}</math> perpendicular to the tangent plane <math>\mathbf{t}</math> into a vector <math>\mathbf{n}^{\prime}</math> perpendicular to the transformed tangent plane <math>\mathbf{Mt},</math> by the following logic:

Write '''n&prime;''' as <math>\mathbf{Wn}.</math> We must find <math>\mathbf{W}.</math> <math display=block>\begin{alignat}{5} W\mathbb n \text{ is perpendicular to } M\mathbb t \quad \, &\text{ if and only if } \quad 0 = (W \mathbb n) \cdot (M \mathbb t) \\ &\text{ if and only if } \quad 0 = (W \mathbb{n})^\mathrm{T} (M \mathbb{t}) \\ &\text{ if and only if } \quad 0 = \left(\mathbb{n}^\mathrm{T} W^\mathrm{T}\right) (M \mathbb{t}) \\ &\text{ if and only if } \quad 0 = \mathbb{n}^\mathrm{T} \left(W^\mathrm{T} M\right) \mathbb{t} \\ \end{alignat}</math>

Choosing <math>\mathbf{W}</math> such that <math>W^\mathrm{T} M = I,</math> or <math>W = (M^{-1})^\mathrm{T},</math> will satisfy the above equation, giving a <math>W \mathbb n</math> perpendicular to <math>M \mathbb t,</math> or an <math>\mathbf{n}^{\prime}</math> perpendicular to <math>\mathbf{t}^{\prime},</math> as required.

Therefore, one should use the inverse transpose of the linear transformation when transforming surface normals. The inverse transpose is equal to the original matrix if the matrix is orthonormal, that is, purely rotational with no scaling or shearing.

==Hypersurfaces in ''n''-dimensional space== For an <math>(n-1)</math>-dimensional hyperplane in <math>n</math>-dimensional space <math>\R^n</math> given by its parametric representation <math display=block>\mathbf{r}\left(t_1, \ldots, t_{n-1}\right) = \mathbf{p}_0 + t_1 \mathbf{v}_1 + \cdots + t_{n-1}\mathbf{v}_{n-1},</math> where <math>\mathbf{p}_0</math> is a point on the hyperplane and <math>\mathbf{v}_i</math> for <math>i = 1, \ldots, n - 1</math> are linearly independent vectors pointing along the hyperplane, a normal to the hyperplane is any vector <math>\mathbf n</math> in the null space of the matrix <math>V = \begin{bmatrix}\mathbf{v}_1 & \cdots &\mathbf{v}_{n-1}\end{bmatrix},</math> meaning {{tmath|1=V\mathbf n = \mathbf 0}}. That is, any vector orthogonal to all in-plane vectors is by definition a surface normal. Alternatively, if the hyperplane is defined as the solution set of a single linear equation {{tmath|1=a_1x_1+\cdots+a_nx_n = c}}, then the vector <math>\mathbf{n} = \left(a_1, \ldots, a_n\right)</math> is a normal.

The definition of a normal to a surface in three-dimensional space can be extended to <math>(n - 1)</math>-dimensional hypersurfaces in {{tmath|\R^n}}. A hypersurface may be locally defined implicitly as the set of points <math>(x_1, x_2, \ldots, x_n)</math> satisfying an equation {{tmath|1=F(x_1, x_2, \ldots, x_n) = 0}}, where <math>F</math> is a given scalar function. If <math>F</math> is continuously differentiable then the hypersurface is a differentiable manifold in the neighbourhood of the points where the gradient is not zero. At these points a normal vector is given by the gradient: <math display=block>\mathbb n = \nabla F\left(x_1, x_2, \ldots, x_n\right) = \left( \tfrac{\partial F}{\partial x_1}, \tfrac{\partial F}{\partial x_2}, \ldots, \tfrac{\partial F}{\partial x_n} \right)\,.</math>

The '''normal line''' is the one-dimensional subspace with basis <math>\{\mathbf{n}\}.</math>

A vector that is normal to the space spanned by the linearly independent vectors {{math|'''v'''{{sub|1}}, ..., '''v'''{{sub|''r''−1}}}} and falls within the {{nowrap|{{mvar|r}}-dimensional}} space spanned by the linearly independent vectors {{math|'''v'''{{sub|1}}, ..., '''v'''{{sub|''r''}}}} is given by the {{nowrap|{{mvar|r}}-th}} column of the matrix {{math|1=Λ = ''V''(''V''{{isup|T}}''V''){{sup|−1}}}}, where the matrix {{math|1=''V'' = ('''v'''{{sub|1}}, ..., '''v'''{{sub|''r''}})}} is the juxtaposition of the {{mvar|r}} column vectors. (Proof: {{math|Λ}} is {{mvar|V}} times a matrix so each column of {{math|Λ}} is a linear combination of the columns of {{mvar|V}}. Furthermore, {{math|1=''V''{{isup|T}}Λ = ''I''}}, so each column of {{mvar|V}} other than the last is perpendicular to the last column of {{math|Λ}}.) This formula works even when {{mvar|r}} is less than the dimension of the Euclidean {{nowrap|space {{mvar|n}}.}} The formula simplifies to {{math|1=Λ = (''V''{{isup|T}}){{sup|−1}}}} when {{math|1=''r'' = ''n''}}.

==Varieties defined by implicit equations in ''n''-dimensional space== A '''differential variety''' defined by implicit equations in the <math>n</math>-dimensional space <math>\R^n</math> is the set of the common zeros of a finite set of differentiable functions in <math>n</math> variables <math display=block> f_1\left(x_1, \ldots, x_n\right), \ldots, f_k\left(x_1, \ldots, x_n\right).</math> The Jacobian matrix of the variety is the <math>k \times n</math> matrix whose <math>i</math>-th row is the gradient of <math>f_i.</math> By the implicit function theorem, the variety is a manifold in the neighborhood of a point where the Jacobian matrix has rank <math>k.</math> At such a point <math>P,</math> the '''normal vector space''' is the vector space generated by the values at <math>P</math> of the gradient vectors of the <math>f_i.</math>

In other words, a variety is defined as the intersection of <math>k</math> hypersurfaces, and the normal vector space at a point is the vector space generated by the normal vectors of the hypersurfaces at the point.

The '''normal (affine) space''' at a point <math>P</math> of the variety is the affine subspace passing through <math>P</math> and generated by the normal vector space at <math>P.</math>

These definitions may be extended {{em|verbatim}} to the points where the variety is not a manifold.

===Example=== Let ''V'' be the variety defined in the 3-dimensional space by the equations <math display=block>x\,y = 0, \quad z = 0.</math> This variety is the union of the <math>x</math>-axis and the <math>y</math>-axis.

At a point <math>(a, 0, 0),</math> where <math>a \neq 0,</math> the rows of the Jacobian matrix are <math>(0, 0, 1)</math> and <math>(0, a, 0).</math> Thus the normal affine space is the plane of equation <math>x = a.</math> Similarly, if <math>b \neq 0,</math> the ''normal plane'' at <math>(0, b, 0)</math> is the plane of equation <math>y = b.</math>

At the point <math>(0, 0, 0)</math> the rows of the Jacobian matrix are <math>(0, 0, 1)</math> and <math>(0, 0, 0).</math> Thus the normal vector space and the normal affine space have dimension 1 and the normal affine space is the <math>z</math>-axis.

==Uses== * Surface normals are useful in defining surface integrals of vector fields. * Surface normals are commonly used in 3D computer graphics for lighting calculations (see Lambert's cosine law), often adjusted by normal mapping. * Render layers containing surface normal information may be used in digital compositing to change the apparent lighting of rendered elements.{{citation needed|date=February 2020}} * In computer vision, the shapes of 3D objects are estimated from surface normals using photometric stereo.<ref>{{cite web |url=http://users.eecs.northwestern.edu/~yingwu/teaching/EECS432/Notes/lighting.pdf |title=Radiometry, BRDF and Photometric Stereo |author=Ying Wu |publisher=Northwestern University }}</ref> *The normal vector may be obtained as the gradient of the signed distance function.

==Normal in geometric optics== {{Main|Specular reflection}} frame|Diagram of specular reflection

The '''{{visible anchor|normal ray}}''' is the outward-pointing ray perpendicular to the surface of an optical medium at a given point.<ref>{{cite web|url=https://www.physicsclassroom.com/class/refln/Lesson-1/The-Law-of-Reflection|title=The Law of Reflection|work=The Physics Classroom Tutorial|url-status=live|archive-url=https://web.archive.org/web/20090427131454/http://www.glenbrook.k12.il.us/GBSSCI/PHYS/CLASS/refln/u13l1c.html|archive-date=April 27, 2009|access-date=2008-03-31}}</ref> In reflection of light, the angle of incidence and the angle of reflection are respectively the angle between the normal and the incident ray (on the plane of incidence) and the angle between the normal and the reflected ray.

==See also== * {{annotated link|Dual space}} * {{annotated link|Ellipsoid normal vector}} * {{annotated link|Normal bundle}} * {{annotated link|Pseudovector}} * {{annotated link|Tangential and normal components}} * {{annotated link|Vertex normal}} * {{annotated link|Mean curvature}}, the average of the signed curvature over all angles

==References== {{Reflist}}

==External links== * {{MathWorld|title=Normal Vector|urlname=NormalVector}} * An [http://msdn.microsoft.com/en-us/library/bb324491(VS.85).aspx explanation of normal vectors] from Microsoft's MSDN * Clear pseudocode for [http://www.opengl.org/wiki/Calculating_a_Surface_Normal calculating a surface normal] {{Webarchive|url=https://web.archive.org/web/20160818003714/https://www.opengl.org/wiki/Calculating_a_Surface_Normal |date=2016-08-18 }} from either a triangle or polygon.

{{Authority control}}

Category:Surfaces Category:Vector calculus Category:3D computer graphics Category:Orthogonality