3. Two pedestrians set out simultaneously from $A$ to $B$ and from $B$ to $A$. When the first had walked half the distance, the second had 24 km left to walk, and when the second had walked half the distance, the first had 15 km left to walk. How many kilometers will the second pedestrian have left to walk after the first finishes his walk?
3. Let $v_{1}, v_{2}$ be the speeds of the first and second pedestrians, $S$ be the distance from $A$ to $B$, and $x$ be the distance the second pedestrian still needs to walk when the first pedestrian finishes the crossing. From the problem statement, we get the system $\frac{S}{2} \frac{v_{2}}{v_{1}}+24=S, \frac{S}{2} \frac{v_{1}}{v_{2}}+15=S$. Denoting $\frac{v_{1}}{v_{2}}=u$ and dividing the second equation by the first, we get $8 u^{2}-6 u-5=0 \Rightarrow u=\frac{5}{4} \Rightarrow S=40 \text{ km}$. Since $S \frac{v_{2}}{v_{1}}+x=S$, then $x=8 \text{ km}$. Answer: 8 km.