Answer
Yes line through (a,b) and (b,a) has slope of -1 and thus is perpendicular line y=x which has slope of 1
Mid point of points (a,b) and (b,a) is $(\frac{a+b}{2}, \frac{a+b}{2})$ and lies on the line y=x
Work Step by Step
To find equation of line through points (a,b) and (b,a)
Slope through points $(x_1, y_1)$ and $(x_2, y_2)$ is given by
$m = \frac{y_2-y_1}{x_2-x_1}$
slope of line through points (a,b) and (b,a)
$m_1 = \frac{a-b}{b-a} = -1$
Above line would be perpendicular to line $ y = x$
as $m_2 = 1$ and $m_1.m_2 = -1$
To show mid points of (a,b) and (b,a) lies on line y = x
From mid point formula,
$x_m = \frac{a+b}{2}$
$ y_m = \frac{b+a}{2}$
And mid points $(x_m, y_m)$ satisfies the equation y=x, so they lie on the line y =x