Given an endpoint and a midpoint, to look for the other endpoint, the midpoint formula is merely manipulated. The average of the x-coordinates for P and Q have to equate to the x-coordinate of M. The same is applied to the y-coordinates. This is shown below:
X-coordinates:
(-2 + Qx)/2 = 5
(-2 + Qx) = 10
Qx = 12
Y-coordinates:
(3 + Qy)/2 = 1
3 + Qy = 2
Qy = -1
Therefore, Q has the coordinates (12 , -1)