Let two known points be A(x 1, y 1) and B(x2, y2), and the midpoint be C(x0, y0).
Because c is the midpoint of AB
So vector AC is equal to vector CB.
The vector AC=(x0-x 1, y0-y 1).
Vector CB=(x2-x0, y2-y0)
So (x0-x 1, y0-y 1) = (x2-x0, y2-y0).
That is x0-x 1 = x2-x0, y0-y 1 = y2-y0.
So x0 = (x 1+x2)/2, y0 = (y 1+y2)/2.