Calculating the curvature of a surface From https://en.wikipedia.org/wiki/Curvature#Local_expressions :

For a plane curve given parametrically in Cartesian coordinates as $f(t)=(x(t), y(t))$, the curvature is $$\kappa = \frac{|x'y''-y'x''|}{\left(x'^2+y'^2\right)^\frac32}$$

What is the general expression for a 3 or higher dimensional surface, e.g. the curvature of $f(t) = (x(t), y(t), z(t))$? 
 A: For an arbitrary dimensional curve (that is, a mapping $f$ from $\mathbb{R}$ to $\mathbb{R}^n$), the curvature is the magnitude of the second derivative with respect to arclength: $|d^2f / ds^2|.$
At a point of a two dimensional surface embedded in three dimensional space, there are two principal curvatures, which are the curvatures of two curves on the surface in two orthogonal directions called the principal directions.  The principal curvatures can be computed in various ways; one way is to compute the eigenvalues of the second fundamental form matrix.  The second fundamental form matrix coefficient $b_{ij}$ is actually very easy to compute.  It is just $S_{ij} \cdot n$, where $S_{ij}$ is the the mixed second partial derivative of the surface mapping $S$ (from $\mathbb{R}^2$ to $\mathbb{R}^3$) with respect to $u^i$ and $u^j$ (where $u^1=u$ and $u^2=v$), and $n$ is the unit surface normal.  The principal curvatures are the basis for all types of curvature on a two-dimensional surface: Gauss curvature is the product of principal curvatures and mean curvature is the average of principal curvatures.  The concept of principal curvatures also generalizes to higher dimensions.
Using the chain rule, it is possible to show that 
$$
  \frac{d^2 f}{ds^2} = \frac{f''|f'| - f'(f''\cdot f')/|f'|}{|f'|^3}
$$
where $'$ denotes differentiation with respect to an arbitrary parameter $t.$  The denominator of this equation is $((x')^2 + (y')^2 + (z')^2 + \dots)^{3/2}.$  The squared norm of the numerator is $(f''\cdot f'')(f'\cdot f') - (f'\cdot f'')^2.$  For two dimensions, this is a perfect square, $(x''y' - x'y'')^2,$ but in three or higher dimensions it is no longer a perfect square.
