General solution to differential equation, given a polynomial general solution I am solving one DE and I have to consider the following:
$$(y+ax)^n(y+bx)$$
to come up with a general solution to the following differential equation:
$$\frac{dy}{dx} = \frac{10x-4y}{3x-y}$$
I find that the coefficient of $x$ in the numerator has to be: $-(ab+abn)$, of $y$: $-(b+an)$. For the denominator, $x$:$(a+nb)$ and $y$:$(n+1)$. When I equate these to my coefficients I get nonsense and inconsistent results, like $n=-2$, which cannot be the case, it has to be positive. What I found in the solution is that they have $k$ after each coefficient like so (where $k\neq0$): $-(b+an)=-4k$,$n+1=-k$, etc. 
And I can't quite understand why they have that $k$ there..
EDIT: You have to differentiate that first line of maths to get the coefficients.
 A: After much penwork, I did the problem in the way you wanted. Your coefficients after differentiation are perfect. Here's where you went wrong. Since after finding $\frac{dy}{dx}$ from the $ \text{expression } = C \text{ (some constant)}$ you get something like this:
$$\frac{dy}{dx} = \frac{-(ab+abn)x -(an+b)y}{(a+bn)x + (n+1)y} = \frac{10x-4y}{3x-y}$$ upto which you're correct. But you must realise that there are three unknown parameters in this equation, namely, $a,b,n$. On the other hand, by equating these $4$ coefficients ony by one to $10,-4,3,-1$, you're solving $4$ equations. $4$ equations in $3$ variables, which is likely to give inconsistent solutions.
Rather you must use  a proportionality. Note that $$\frac{5}{10}=\frac{1}{2}$$ but $5 \not=1$ and $10\not=2$. What is true however is that the ratio of $5$ to $1$ is the same as that of $10$ to $2$. If you simplify $\frac{5}{10}$ such that the numerator contains $1$ then the denominator will be exactly $2$.
Here, you do the same. Make a pair of corresponding terms in the middle side and the right hand side equal. And then equate the coefficients.
For example, $$\frac{\frac{(ab+abn)}{(n+1)}x +\frac{(an+b)}{(n+1)}y}{-\frac{(a+bn)}{(n+1)}x - y} =\frac{abx +\frac{(an+b)}{(n+1)}y}{-\frac{(a+bn)}{(n+1)}x - y} = \frac{10x-4y}{3x-y}$$
Now you can equate the coefficients one by one. Can you take it from here?
