The distance of a point from a line Ax+By+C=0 is
I took a point on the line (x,y) and any other point (x1,y1). I wrote the distance between them and replaced y with an expression of x using the equation of the line.
Then i differentiated the expression to find the minimum distance. I got this
Bx - Bx1 + A ( y1 + (Ax + c)/B ) divided by sqrt ( B2(x1-x)2 + (By1 + Ax + c)2)