Answer
The moon Phobos can be a maximum distance of $~~2856.4~miles~~$ away from Mars in order for a total eclipse of the sun to occur on Mars.
Work Step by Step
On the diagram, we can see that $\angle cdo = \angle abo = 90^{\circ}$ and $\angle doc = \angle boa$. Therefore, $\angle dco = \angle bao$, and the triangles $\triangle cdo$ and $\triangle abo$ are similar triangles.
$\overline{co} = 142,000,000~mi$
$\overline{cd} = \frac{865,000~mi}{2} = 432,500~mi$
$\overline{ab} = \frac{17.4~mi}{2} = 8.7~mi$
Since the two triangles are similar triangles, we can set up the following equation in order to find the maximum distance $\overline{ao}$:
$\frac{\overline{ao}}{\overline{ab}} = \frac{\overline{co}}{\overline{cd}}$
$\overline{ao} = \frac{\overline{ab}\cdot \overline{co}}{\overline{cd}}$
$\overline{ao} = \frac{(8.7~mi)(142,000,000~mi)}{432,500~mi}$
$\overline{ao} = 2856.4~mi$
The moon Phobos can be a maximum distance of $~~2856.4~miles~~$ away from Mars in order for a total eclipse of the sun to occur on Mars.