Contradictory FOC and maximizing solution I have to maximize the following function -
$\max_{x \in (0,1)} (((p_1x)^{2r} + (p_2(1-x))^{2r})/2)^{1/r}$
where, $p_1$ and $p_2$ are drawn from uniform distribution [0,1] and are considered to be given for this maximization problem.
FOC are given as -
$\frac x {1-x}$ = ${(p_2/p_1) }^{2r/{2r-1}}$
My problem is -
Whenever $p_1$ &gt; $p_2$, FOC argues that value of x should be &lt; 1/2 but this doesn't maximize the function. Rather solution should be x&gt;1/2. Why the FOC solution is not maximizing the objective function. What have I done wrong?
As alluded to by Bertrand in his +1 comments this is because FOCs do not tell you where maximum or minimum occurs. This is common misconception among some students but it simply does not hold.
FOCs give you location of stationary points. They give you points where $df(x,y)/dx = df(x,y)/dy= 0$.
A maximum or minimum will occur at points where $df(x,y)/dx = df(x,y)/dy= 0$, but so will saddle points. FOCs cannot distinguish between whether point is maximum, minimum or saddle point, it can just tell you that you found points at which slope is zero.
What even more a function can have multiple local maxima/minima and saddle points. In optimization you will generally want want to find the global maximum not just a local maximum. You can see this visualized at a figure below taken from EMEA by Sydsæter, Hammond &amp; StrØm.

If you want to know whether the point is maximum or minimum you need to examine second order conditions (SOCs) which tells you whether the function is concave or convex (or some people like to call it concave down) then based on the concavity of the function you can infer if it is a local maximum, minimum or saddle point. For non-constrained (e.g. Lagrangian SOCs are different) multivariable optimization SOCs are given by:
A function will be concave (implying local maximum) if the conditions for $C^2$ function in $\mathbb{R}^2$ are satisfied:
$$f_{11}''(x, y) \leq 0, f_{22}''(x, y) \leq 0, \text{ and } f_{11}''(x, y)f_{22}''(x, y) − 
(f_{12}''(x, y))^2
\geq 0$$
A function will be convex (implying local maximum) if the conditions for $C^2$ function in $\mathbb{R}^2$ are satisfied:
$$f_{11}''(x, y) \geq 0, f_{22}''(x, y) \geq 0, \text{ and } f_{11}''(x, y)f_{22}''(x, y) − 
(f_{12}''(x, y))^2
\geq 0$$
However, the conditions above only tell you if you found local minimum or maximum. In order to find global maximum/minimum, you have to examine all maximums or minimums as well as the boundaries of your function (e.g. maximum could occur at some endpoints for example $y=x+10$ defined on interval $x\in[0,10]$ will have maximum at the upper boundary $x=10$ even if FOC does not find any stationary point at $X=10$) and check which of their output value is highest or lowest (although most introductory problems will typically be set in a way there is only one max or min - this is likely why some students confuse FOCs as conditions for max or min rather than just conditions for stationary points).