One way to find such a vector is to use the fact that two nonzero vectors with a dot product of zero must be perpendicular. If we choose a vector parallel to the linear function graph, we can find a normal vector by finding a vector whose dot product with the first is zero.
For example, for the graph of the function
f(x) = px + k,
we can choose the parallel vector (1, p). For the normal vector N, it must be true that
N⋅(1, p) = 0.
One vector which satisfies this equation and is thus a normal vector is (-p, 1).
We can use the same method for the graph of the implicit function
ax + by = c.
One vector which is parallel to the graph is (b, -a).
(a, b) is a normal vector because its dot product with (b, -a) is 0.