Given a normal vector field, how does one extract the surface? There is a surface $z(x,y)$ that I would like to learn. I am given the surface's normal vector field, $\hat{n}(x,y)$. That is, $\hat{n}(x,y)$ is the vector field that points in the direction perpendicular to $z(x,y)$. I would like to know $z(x,y)$. Is there a way to do this? Even an approximation or numerical method would suffice.
 A: One solution, if you know a little about differential forms, is to turn the normal vector field into a $1$-form $\omega$. You then hope to solve $\omega=0$ to get the surfaces. (The advantage here is that you needn't look for a graph; you will find level surfaces of a function instead.) For example, if you had $\vec n = (x,y,z)$, you would take
$$\omega = x\,dx + y\,dy + z\,dz$$
and observe that $\omega = df$ for $f(x,y,z) = \frac12(x^2+y^2+z^2)$. So your surface(s) will be level sets of $f$, i.e., spheres centered at the origin.
In general, not every $\omega$ will lead to an integrable situation. For example, if you took
$$\omega = x^2\,dx + xy\,dy + xz\,dz,$$
it would not be integrable, but there would be an integrating factor (namely, $1/x$). But if you took
$$\omega = -y\,dx + dz,$$
then there are no integral surfaces at all. This is a famous example. Of course, from your approach, you could see that there is no function $g(x,y)$ so that this is the graph $z-g(x,y)=0$, since we would need $\partial g/\partial x = y$ and $\partial g/\partial y = 0$; why is there no such function?
There is a test for whether an integrating factor exists or not. In terms of vector fields, you're asking whether your $\vec n$ (now considered as a function of three variables) satisfies $\vec n\times\text{curl }\vec n = 0$.
A: Since $\hat{n}(x,y)$ is perpendicular to the surface, the two vector field
$\frac{\partial}{\partial x}\left(x, y, z(x,y)\right)$
and
$\frac{\partial}{\partial y}\left(x, y, z(x,y)\right)$
should be perpendicular to, i.e. have vanishing dot product with, $\hat{n}(x,y)$.
This gives a couple of partial differential equations to solve.
