Solving a maximization problem by substitution when the constraint is in implicit form I am trying to understand how the first order conditions for an interior solution of a maximization problem were derived using the substitution method. 

The problem is:
$$\max\limits_{x\ge0,y\ge0}P(a-x)+(1-P)(b-y)$$
subject to
$$Pf(x)+(1-P)f(y)=c$$
where: $a,b,c&gt;0$, $P\in (0,1)$, $f:[0,+\infty]\to[0,+\infty]$, increasing and strictly concave over its domain.

I can see how this is solved using a lagrangian to find from the first order conditions that $f'(x^*)=f'(y^*)$. Strict concavity of $f$ then implies $x^*=y^*$. But I'm at a loss as to how we can solve it by substituting the constraint in the objective function. Since $f$ is invertible, if $y$ did not appear in the constraint I would find $x$ from the constraint by inverting $f$ and substitute it in the objective function. Doing this here leads to complications that seem unnecessary for this simple problem. There has to be a simpler way that I cannot figure out: what is it? Thanks!
Here are two methods. First method: the substitution can be made by inverting $f$. Since $f$ is strictly increasing and continuous, $f^{-1}$ is well-defined. The constraint can therefore be written
\begin{equation*}
x = f^{-1}\Big(\dfrac{c-(1-P)f(y)}{P}\Big)
\end{equation*}

The objective becomes
\begin{equation*}
\max_{y \geq 0}{P \Big[a-f^{-1}\Big(\dfrac{c-(1-P)f(y)}{P}\Big)\Big]+(1-P) (b-y)}
\end{equation*}

The derivative of this expression with respect to $y$ equals
\begin{align*}
&amp; (1-P) f'(y) (f^{-1})^{'}(\dfrac{c-(1-P)f(y)}{P})-(1-P) \\
= &amp; (1-P) \dfrac{f'(y)}{f^{'} \circ f^{-1}(\dfrac{c-(1-P)f(y)}{P})}-(1-P) \\
&amp; = (1-P) (\dfrac{f'(y)}{f'(x)}-1)
\end{align*}
And thus $f'(y^{*})=f'(x^{*})$ at the optimum.

Second method: since $f$ is invertible, we can do a change in variables and define $w=f(x)$ and $z=f(y)$. The problem then becomes
\begin{equation*}
\max_{w \geq 0, z\geq 0}{P(a-f^{-1}(w))+(1-P)(b-f^{-1}(z))}
\end{equation*}
subject to 
\begin{equation*}
P w +(1-P)z=c
\end{equation*}
Substituing $w=(c-(1-P)z)/P$ in the problem delivers
\begin{equation*}
\max_{z\geq 0}{P(a-f^{-1}(\dfrac{c-(1-P)z}{P})+(1-P)(b-f^{-1}(z))}
\end{equation*}
Differentiating with respect to $z$ yields the same solution.