I am looking at the solution to this exercise that says
Suppose the differential equation $$P(x,y)dx+Q(x,y)dy=0$$ has an integrating factor $\mu(x,y)$ which leads to a one-parameter family of solutions of the form $\phi(x,y)=C$. If the slope of the curve $\phi(x,y)=C$ at $(x,y)$ is $tan\theta$, the unit normal vector $\pmb{n}$ is taken to mean $$\pmb{n}=sin\theta\pmb{i}-cos\theta\pmb{j}.$$ There is a scalar field $g(x,y)$ such that the normal derivative of $\phi$ is given by the formula $$\frac{\partial\phi}{\partial n}=\mu(x,y)g(x,y),$$ where $\frac{\partial\phi}{\partial n}=\nabla\phi\cdot\pmb{n}$. Find an explicit formula for $g(x,y)$ in terms of $P(x,y)$ and $Q(x,y)$.
The solution of the exercise (I cheated, I know) reported at the end of the book is
$$g(x,y)=\pm\sqrt{P^2(x,y)+Q^2(x,y)}$$
What I observed to justify this is that if the equation $P(x,y)dx+Q(x,y)dy=0$ has an integrating factor $\mu(x,y)$, it means that the equation $\mu(x,y)P(x,y)dx+\mu(x,y)Q(x,y)dy=0$ is exact, i.e. the field $\mu(x,y)P(x,y)\pmb{i}+\mu(x,y)Q(x,y)\pmb{j}$ is the gradient of the field $\phi(x,y)$. I then observe that being the gradient always orthogonal to level curves, it is always aligned with the unit outer normal $\pmb{n}$, hence the scalar product $\nabla\phi\cdot\pmb{n}$ is the magnitude of the gradient itself, $\sqrt{\mu^2(x,y)P^2(x,y)+\mu(x,y)^2Q^2(x,y)}$, and the solution derives from the fact that an integrating factor is always non zero when needed.
Does this logic make sense? I don't understand how the definition of unit normal vector in terms of $\theta$ could be used... maybe in a more rigorous proof which I fail to grasp. Also, is the solution of this exercise used as a formula to solve a particular class of differential equations?
Thanks