4. Given are two mutually perpendicular lines $p$ and $q$ and a point $O$ that does not lie on either of the lines $p$ and $q$. A variable line through point $O$ intersects the lines $p$ and $q$ at points $A$ and $B$, respectively. Find the geometric locus of the midpoints $M$ of the segments $A B$.
Solution. Let us choose a rectangular coordinate system with origin at point $O$ and coordinate axes parallel to the lines $p$ and $q$ respectively. If the $x$-axis is parallel to line $p$, and the $y$-axis is parallel to line $q$, then the equations of lines $p$ and $q$ will be $y=a$ and $x=b$ respectively. The equation of an arbitrary line through point $O$ will be $y=kx$, where $k$ is a real parameter. This line intersects line $p$ at point $A\left(\frac{a}{k}, a\right)$, and line $q$ at point $B(b, kb)$. The midpoint $M$ of segment $AB$ will have coordinates

$$
x=\frac{1}{2}\left(\frac{a}{k}+b\right), \quad y=\frac{1}{2}(a+k b)
$$

By eliminating the parameter $k$, we obtain $2xy=ax+by$, which represents the equation of the desired geometric locus.