Originally Posted by
masters The slope of $\displaystyle y=x$ is 1.
You'll need to find the slope of the segment between (a, b) and (b, a).
$\displaystyle m=\frac{y_2-y_1}{x_2-x_1}=\frac{a-b}{b-a}=\frac{-(b-a)}{b-a}=-1$
Since the slopes are negative reciprocals of each other, the lines are perpendicular.
$\displaystyle y=x$ is the linear identity function. this means the x and y values are identical.
The midpoint between (a, b) and (b, a) can be found using the midpoint formula:
$\displaystyle M=\left(\frac{a+b}{2}, \frac{b+a}{2}\right)$
Since both x and y values of the midpoint are identical, then the midpoint has to lie on the identity function $\displaystyle y=x$