Functions with mutually orthogonal gradients at every point I am not completely sure if the question is too broad, but here goes. If we are given a function $f:\mathbb{R}^2 \to \mathbb{R}$, is there any way to find other non-constant functions $g:\mathbb{R}^2 \to \mathbb{R}$ such that at every point their gradients are orthogonal? In other words, given $f$ can we find a non-constant $g$ such that $\nabla f\cdot \nabla{g}=0$ for every $(x,y) \in \mathbb{R}^2$? For given $f$ I am interested in a criterion if such functions $g$ exist, and if so how would be a way to find them.
As an example, if $f(x,y)=x$, then $g(x,y)=y$ satisfies that property. If $f(x,y)=x^2+y^2$? It would have to be a solution of the PDE $xf_x+yf_y=0$, which unfortunately I don't remember my PDEs now to try to solve.
The broader question is essentially if we can say anything about the following PDE for a given $f$.
$$f_xg_x+f_yg_y=0$$
Assume any nice conditions you may want about $f$, such as $f\in C^{\infty}$ etc. If the topic is too broad for an answer, I would at least appreciate any pointers for a direction to read further about it. This also relates to products of harmonic functions, specifically a product of two harmonic functions is also harmonic if the above condition on the gradients is satisfied.
 A: This is not at all my area but some scattered thoughts. The closest keyword I've been able to find so far is orthogonal trajectories; maybe these are also called orthogonal families of curves.
I think it is possible to understand solutions using the method of characteristics, but I'm not very familiar with it. For $f(x, y) = x^2 + y^2$ the method gives that we want to solve the Lagrange-Charpit equations
$$\frac{dx}{dt} = x, \frac{dy}{dt} = y, \frac{dz}{dt} = 0$$
which gives $x(t) = x(0) e^t, y(t) = y(0) e^t, z(t) = z(0)$. The method of characteristics gives that the graph of $z = g(x, y)$ must be traced out by these curves, so $z(0) = g(x(0) e^t, y(0) e^t)$. So $g$ must be constant on every ray through the origin; in polar coordinates this gives that $g$ must be a function of the angle $\theta$ only. The solution $g(x, y) = \frac{y}{x}$, which can be found by looking for a formal Laurent series solution, is $\tan \theta$. We also have solutions
$$g(x, y) = \sin \theta = \frac{y}{\sqrt{x^2 + y^2}}$$
$$g(x, y) = \cos \theta = \frac{x}{\sqrt{x^2 + y^2}}$$
disregarding their singularities at the origin. Geometrically the point is that $x g_x + y g_y = 0$ says that the gradient of $g$ at any point always points orthogonal to the outward radial direction, or equivalently always points in the $\theta$ direction, which in retrospect is clear. It follows that $\lim_{(x, y) \to (0, 0)} g(x, y)$ does not exist unless $g$ is constant (since if $g$ is nonconstant then it is nonconstant  with the same values on every circle), so no nonconstant solution to $x g_x + y g_y = 0$ is defined on all of $\mathbb{R}^2$.
In general the Lagrange-Charpit equations are
$$\frac{dx}{dt} = f_x, \frac{dy}{dt} = f_y, \frac{dz}{dt} = 0$$
and unfortunately I don't know how to say anything about solutions at this level of generality. $g$ is again determined by the condition that $z(0) = g(x(t), y(t))$, so $(x(t), y(t))$ parameterizes the level curves of $g$.
Here is at least another interesting example. If we take $f(x, y) = xy$ then $\frac{dx}{dt} = y, \frac{dy}{dt} = x$ which has solutions
$$(x, y) = a(\cosh t, \sinh t) + b(\sinh t, \cosh t)$$
for constants $a, b$. These curves trace out hyperbolas $x^2 - y^2 = a^2 - b^2$, so the condition is that $g$ must be constant on all such hyperbolas. So $g$ must be a function of $x^2 - y^2$, and indeed if $g(x, y) = x^2 - y^2$ then $(g_x, g_y) = (2x, -2y)$.
These examples suggest the following general fact, which is that if $(f, g)$ is a pair of functions satisfying $f_x g_x + f_y g_y = 0$ then the same is true of the pair of functions $(h_1(f), h_2(g))$, for any functions $h_1, h_2$, since the gradients at any point are scalar multiples of the original gradients. So the "invariant content" of the solutions really is the families of orthogonal level curves of $f$ and $g$, rather than any particular function with those level curves, unless we ask for more hypotheses such as harmonicity as you mention.
