Answer
$x-y-3=0$
Work Step by Step
First we determine the coordinates of the midpoint $M(x_M,y_M)$ of $AB$:
$$\begin{align*}
x_M&=\dfrac{x_A+x_B}{2}=\dfrac{1+7}{2}=4\\
y_M&=\dfrac{y_A+y_B}{2}=\dfrac{4+(-2)}{2}=1.
\end{align*}$$
Therefore we have to determine the equation of the line perpendicular on $AB$ and passing through the point $M(4,1)$.
We determine the slope $m_{AB}$ of the line passing through $A$ and $B$:
$$m_{AB}=\dfrac{y_B-y_A}{x_B-x_A}=\dfrac{-2-4}{7-1}=-1.$$
Determine the slope $m$ of the line perpendicular to $AB$:
$$\begin{align*}
mm_{AB}&=-1\\
m\cdot (-1)&=-1\\
m&=1.
\end{align*}$$
Therefore the equation of the perpendicular on $AB$ is:
$$y=x+b.$$
In order to find $b$ use the coordinates of the point $M$ which belongs to this line:
$$\begin{align*}
1&=4+b\\
b&=-3.
\end{align*}$$
The equation of the perpendicular bisector is:
$$\begin{align*}
y=x-3\\
x-y-3&=0.
\end{align*}$$