In Euclidean space, the Laplacian is defined as Δ=−∑i∂2/∂(xi)2. The challenge with discretizing the Laplacian is that, the Laplacian takes the second derivative, but the discrete meshes don't have a natural second derivative.
Integration by Parts
One technique is to use integration by parts to lower the order of differentiation: On a manifold M, given functions f:M→R and g:M→R,
∫ΩfΔgdA=boundary terms+∫Ω∇f⋅∇gdA
This formula coverts an expression that requires the second derivative to an expression that requires only the first derivative. On a discrete mesh, it is easier to cook up basis of functions on discrete mesh that at least have one derivative.
To use integration by parts, we convert a function f:M→R to its dual function Lf:L2(M)→R by integrating it against a "test" function g:M→R:
Lf[g]=∫Mf(x)g(x)dA(x)
Note that to evaluate the function f at a point y, we just need to use the delta function as the test function,
Lf[δy]=∫Mf(x)δy(x)dA(x)=f(y)
In our case, we want to evaluate Δf , whose dual is
LΔf[g]=∫Mg(x)Δf(x)dA(x)=∫M∇g(x)⋅∇f(x)dA(x)+∮∂Mg(x)∇f(x)⋅n(x)dl
where the last expression in the equation is the boundary term, which we can ignore for closed meshes.
Hat Function

We define a basis of functions ψ1(x),…,ψk(x):M→R, where each function ψi(x) is a "hat" function centered on vertex i (image of a hat function is shown above, courtsey K. Crane, CMU). Then we can decompose any function f:M→R into f=∑i=1kfiψi by setting fi to be the value of f at vertex i. Intuitively, since a discrete function f is only defined on the vertices, the hat functions ψi simply interpolates the value of f on the faces of the triangle mesh in a linear fashion (known as barycentric interpolation).
Discretization
We can evaluate the dual LΔf of the Laplacian Δf with a test function g by writing f and g in terms of the basis of the hat function
LΔf[g]=∑ijgifj∫MΔψi⋅Δψj dA
Note that, since the gradient of the hat function is constant over a triangle, the dual Laplacian is simply a sum of scalar values (dot products) per face multiplied by the triangle area.
On a triangle with vertex i and edge ei, the gradient Δψi is simply hi/∣∣hi∣∣2 where hi is the height vector normal to the edge ei and pointing at the vertex i.
When i=j, the integral ∫Δψi⋅Δψj dA on the triangle with vertex i evaluates to A∣∣∇ψi∣∣2=A/∣∣h∣∣2=(cot(α)+cot(β))/2, where A is the area of the triangle and α and β are the two angles opposite to the vertex i. Then the integral ∫MΔψi⋅Δψi dA over the entire mesh M is simply the sum of the integrals over all neighboring triangles Nk of vertex i:∑k∈Ni(cotαik+cotβik)/2.
When i=j, the integral ∫∇ψi⋅∇ψjdA on the triangle with vertex i and j evaluates to −(cotθ)/2 where θ is the angle not on either of the two vertices i and j. Then the integral ∫MΔψi⋅Δψj dA over the entire mesh M is the sum of integrals over all triangles that incident on edge eij, namely (cotαij+cotβij)/2 where αij and βij are the angles not on either of the two vertices i and j.
Therefore, if we want to evaluate the Laplacian at vertex i, we can set the test function to be ψi, and evaluate the Laplacian LΔf[ψi] to be:
LΔf[ψi]=fi∫M∇ψi⋅∇ψi dA+∑k∈Nifk∫M∇ψi⋅∇ψk dA
Plugging in the integrals of the hat functions,
LΔf[ψi]=fi∑k∈Ni(cotαik+cotβik)/2−∑k∈Nifk(cotαik+cotβik)/2
We can write this equation in matrix format, L, where the ij-th entry is
Lij=⎩⎪⎪⎨⎪⎪⎧∑k∈Ni(cotαik+cotβik)/2−(cotαij+cotβij)/20if i=jif ij are adjacentotherwise
L is known as the discrete cotangent Laplacian matrix.