# Why do we need to differentiate wrt x in case of non-vertical lines and wrt y in case of non-horizontal lines?

The question was to find a differential equation representing non horizontal lines and the line eqn ax+by=1 was differentiated wrt x and. Exactly the opposite was done in case of non verical lines. I wonder why it was done..

$$ax+by=1\tag{1}$$
where at least one of $a$ and $b$ is nonzero. The line is horizontal if and only if $a=0$ and vertical if and only if $b=0$.
In order for $(1)$ to implicitly define $y$ as a function of $x$ it must be (by the Linear Implicit Function Theorem) that $b\neq0$, i.e. it must be that the line is not vertical. In fact when $b\neq 0$ we can solve explicitly for $y$ as a function of $x$: $$y(x)=\frac{1-ax}{b}$$
If $b=0$, the line is vertical and for each $x$ there are many corresponding $y$-values on the graph of the line, and so the line is not the graph of a function of $x$.
Similarly, in order for $(1)$ to implicitly define $x$ as a function of $y$ it must be that $a\neq 0$, i.e. it must be that the line is not horizontal.