Presumably, you want a smooth transition from the red arc to the black ones. (As it turns out, your $45^\circ$ line interpretation is inaccurate, but we'll get back to that.) So,
The little circle must be tangent to the $y$-axis at $P_2$. In particular, this means that $P_4$ is exactly $g$ units to the right of $P_2$; that is, $|P_2P_4| = g$.
The little circle must be tangent to the big circle at $P_3$. A bit of circle geometry tells us that $P_4$ must lie on the radius $P_1P_3$. Thus, $|P_1P_4| = |P_1P_3|-|P_3P_4| = r - g$.
Now we know the lengths of two sides of right triangle $\triangle P_1P_2P_4$, and we can apply the Pythagorean Theorem to find the third:
$$\begin{align}
|P_1P_2|^2 + |P_2 P_4|^2 &= |P_1 P_4|^2 \\[6pt]
|P_1P_2|^2 + g^2 &= ( r - g )^2 \\[6pt]
|P_1P_2|^2 &= ( r - g )^2 - g^2 = r ( r - 2 g )
\end{align}$$
Simply note that $|P_2P_4|$ is the $x$-coordinate of $P_4$, and $|P_1P_2|$ is the $y$-coordinate. Therefore,
$$P_4 = \left( \; g, \; \sqrt{r(r-2g)} \; \right)$$
Because there's no $45^\circ$ line between $P_2$ and $P_3$ (at least, not usually), you'll probably also need to know that
$$\begin{align}
P_2 &= \left( \; 0, \; \sqrt{r(r-2g)} \; \right) &\text{(same $y$ as $P_4$, but on $y$-axis)} \\[6pt]
P_3 &= \left( \; \frac{gr}{r-g}, \; \frac{r\;\sqrt{r(r-2g)}}{r-g} \; \right) &\text{(scaling-up $P_4$ by $\frac{|P_1P_3|}{|P_1P_4|} = \frac{r}{r-g}$)}
\end{align}$$
To see why there's no $45^\circ$ line, consider an extreme case, where $r = 2g$. Here, the red arc is a full semi-circle that immediately starts up at $P_1$, and comes back down at $r$ units to the right on the $x$ axis; that is, $P_2$ is identical to $P_1$, and $P_3$ lies at the point $(r,0)$: the line between these points is the $x$-axis, which is inclined at $0^\circ$, not $45^\circ$.
(Double-checking the formulas in this case: $P_2 = (0,0)$, $P_3 = (2g,0)$, $P_4=(g,0)$. Yup, they work!)
(Another check: When $g=0$, we expect there to be no red arc at all, so that $P_2=P_3=P_4=(0,r)$. Yup, the formulas work there, too!)
graph-theorytag (which is for an entirely-different subject). – Blue Jul 11 '13 at 19:16