Since Y is the midpoint of XZ, YZ will be half of the line. So, you can set up the equation 2(YZ) = XZ and substitute the values in to solve for x.
2(YZ) = XZ Substitute in the values
2(2x + 1) = 8x - 2 Use the Distributive Property
4x + 2 = 8x - 2 Add 2 to both sides
4x + 4 = 8x Subtract 4x from both sides
4 = 4x Divide both sides by 4
1 = x Switch the sides to make it easier to read
x = 1