Linking number
In mathematics, the linking number is a numerical invariant that describes the linking of two closed curves in three-dimensional space.  Intuitively, the linking number represents the number of times that each curve winds around the other.  The linking number is always an integer, but may be positive or negative depending on the orientation of the two curves.
The linking number was introduced by Gauss in the form of the linking integral.  It is an important object of study in knot theory, algebraic topology, and differential geometry, and has numerous applications in mathematics and science, including quantum mechanics, electromagnetism, and the study of DNA supercoiling.

# Definition
Any two closed curves in space can be moved into exactly one of the following standard positions.  This determines the linking number:
Each curve may pass through itself during this motion, but the two curves must remain separated throughout.

# Computing the linking number
There is an algorithm to compute the linking number of two curves from a link diagram.  Label each crossing as positive or negative, according to the following rule:
The total number of positive crossings minus the total number of negative crossings is equal to twice the linking number.  That is:
where n1, n2, n3, n4 represent the number of crossings of each of the four types. The two sums n_1 + n_3\,\! and n_2 + n_4\,\! are always equal, which leads to the following alternative formula
Note that n_1-n_4 involves only the undercrossings of the blue curve by the red, while n_2-n_3 involves only the overcrossings.

# Properties and examples
- Any two unlinked curves have linking number zero.  However, two curves with linking number zero may still be linked (e.g. the Whitehead link).
- Reversing the orientation of either of the curves negates the linking number, while reversing the orientation of both curves leaves it unchanged.
- The linking number is chiral: taking the mirror image of link negates the linking number.  Our convention for positive linking number is based on a right-hand rule.
- The winding number of an oriented curve in the x-y plane is equal to its linking number with the z-axis (thinking of the z-axis as a closed curve in the 3-sphere).
- More generally, if either of the curves is simple, then the first homology group of its complement is isomorphic to Z.  In this case, the linking number is determined by the homology class of the other curve.
- In physics, the linking number is an example of a topological quantum number.  It is related to quantum entanglement.

# Gauss's integral definition
Given two non-intersecting differentiable curves \gamma_1, \gamma_2 \colon S^1 \rightarrow \mathbb{R}^3, define the Gauss map \Gamma from the torus to the sphere by
Pick a point in the unit sphere, v, so that orthogonal projection of the link to the plane perpendicular to v gives a link diagram.  Observe that a point (s,t) that goes to v under the Gauss map corresponds to a crossing in the link diagram where \gamma_1 is over \gamma_2.  Also, a neighborhood of (s,t) is mapped under the Gauss map to a neighborhood of v preserving or reversing orientation depending on the sign of the crossing.  Thus in order to compute the linking number of the diagram corresponding to v it suffices to count the signed number of times the Gauss map covers v.  Since v is a regular value, this is precisely the degree of the Gauss map (i.e. the signed number of times that the image of  covers the sphere).  Isotopy invariance of the linking number is automatically obtained as the degree is invariant under homotopic maps.  Any other regular value would give the same number, so the linking number doesn't depend on any particular link diagram.
This formulation of the linking number of 1 and 2  enables an explicit formula as a double line integral, the Gauss linking integral:
\oint_{\gamma_1}\oint_{\gamma_2}
\frac{\mathbf{r}_1 - \mathbf{r}_2}{|\mathbf{r}_1 - \mathbf{r}_2|^3}
\cdot (d\mathbf{r}_1 \times d\mathbf{r}_2).
This integral computes the total signed area of the image of the Gauss map (the integrand being the Jacobian of ) and then divides by the area of the sphere (which is 4).

# Generalizations
- Just as closed curves can be linked in three dimensions, any two closed manifolds of dimensions m and n may be linked in a Euclidean space of dimension m + n + 1.  Any such link has an associated Gauss map, whose degree is a generalization of the linking number.
- Any framed knot has a self-linking number obtained by computing the linking number of the knot C with a new curve obtained by slightly moving the points of C along the framing vectors.  The self-linking number obtained by moving vertically (along the blackboard framing) is known as Kauffman's self-linking number.

# Notes
-  This is the same labeling used to compute the writhe of a knot, though in this case we only label crossings that involve both curves of the link.
-  This follows from the Jordan curve theorem if either curve is simple.  For example, if the blue curve is simple, then  n1 + n3 and n2 + n4 represent the number of times that the red curve crosses in and out of the region bounded by the blue curve.