Finding the equation of a curve where the gradient is $ax + b$ at all points. The gradient of a curve is $ax + b$ at all points, where $a$ and $b$ are constants. Find the equation of the curve given that it passes through the points $(0,4)$ and $(1,3)$ and that the tangent at $(1,3)$ is parallel to the $x$-axis. 
My workings so far are: 
$\int ax + b$ $dx$ $= \frac{ax^2}{2} + bx + c$
for $(0,4)$: 
$ 4 = \frac{a * (0^2)}{2} + b * 0 + c $
$ 4 = 0+c $
therefore $ c = 4 $
making the equation $\frac{ax^2}{2} + bx + 4$
for $(1,3)$: 
$3 = \frac{a*(1^2)}{2} + b*1 + 4 $
$3 = \frac{a}{2} + b + 4$ 
The answer given is $y = x^2 - 2x + 4$ 
So I feel like I've got most of the way there, I'm just stuck on where to go next e.g. finding the values for $a$ and $b$, so any help would be greatly appreciated. 
Thanks

Well, the tangent line at $(1,3)$ is parallel to the $x$-axis, meaning that the gradient when $x=3$ is $0.$
On the other hand, we know that the gradient is always of the form $ax+b$ at any given $x.$ In particular, the gradient when $x=3$ is $3a+b.$
Now you have two linear equations with variables $a$ and $b,$ which will let you finish the problem.
