a is the midpoint of segment XY.find the value of x and the length of XY

ANSWER
x = 3, XY = 18
EXPLANATION
We have that A is the midpoint of XY. It means that A divides XY into 2 equal parts.
This means that:
XA = AY
We have that:
XA = 3x
AY = 5x - 6
=> 3x = 5x - 6
Collect like terms:
3x - 5x = -6
-2x = -6
Divide through by -2:
x = -6 / -2
x = 3
That is the value of x.
Since A is the midpoint of XY and XA = AY, then:
XY = 2XA or XAY
So:
XY = 2XA
XY = 2 * 3x = 2 * 3(3)
XY = 2 * 9
XY = 18
That is the value of XY.