3. Given the line $y=\frac{1}{2} x+1$ intersects the $x$-axis and $y$-axis at points $A$ and $B$ respectively. Then the equation of the perpendicular bisector of line segment $A B$ is . $\qquad$
3. $y=-2 x-\frac{3}{2}$.

As shown in Figure 6, let the perpendicular bisector of line segment $AB$ intersect $AB$ at $C$ and the negative half of the $x$-axis at $D$. Connect $BD$.
Then $AD=BD$.
It is easy to see that $A(-2,0)$ and $B(0,1)$.
By the Midline Theorem of a triangle, we know $C\left(-1, \frac{1}{2}\right)$.
Let $D(a, 0)$. Then $AD=a+2$.
In the right triangle $\triangle BOD$, by the Pythagorean theorem, we have $BD^2=OD^2+OB^2$.
Therefore, $(a+2)^2=a^2+1^2$. Solving for $a$ gives $a=-\frac{3}{4}$. Thus, $D\left(-\frac{3}{4}, 0\right)$.
Let the equation of line $CD$ be $y=kx+b$. Then $\left\{\begin{array}{l}\frac{1}{2}=-k+b, \\ 0=-\frac{3}{4} k+b .\end{array}\right.$
Solving these equations gives $k=-2, b=-\frac{3}{2}$.
Therefore, the equation of the perpendicular bisector of line segment $AB$ is $y=-2 x-\frac{3}{2}$.