I'm trying to solve a contrained consumer problem with Cobb-Douglas preferences with Wolfram Mathematica 13.1. This problem is simple and can be solved analyticaly. But my code doesn't work.
Utility = x1^\[Alpha] * x2^(1 - \[Alpha])
constraint = p1*x1 + p2*x2 - r
Lagrangian = Utility - \[Lambda]*constraint
Foc1 = D[Lagrangian, x1]
Foc2 = D[Lagrangian, x2]
Foc3 = D[Lagrangian, \[Lambda]]
sols = Solve[{Foc1 == 0, Foc2 == 0, Foc3 == 0}, {x1, x2, \[Lambda]}]
This give me the following output:
Solve::incnst: Inconsistent or redundant transcendental equation. After reduction, the bad equation is r-p1 x1-p2 x2 == 0.
Solve::svars: Equations may not give solutions for all "solve" variables.
I tried to simplify my code to:
Solve[{x1^(-1 + \[Alpha]) x2^(1 - \[Alpha]) \[Alpha] - p1 \[Lambda] == 0,
x1^\[Alpha] x2^-\[Alpha] (1 - \[Alpha]) - p2 \[Lambda] == 0,
r - p1 x1 - p2 x2 == 0},
{x1, x2, \[Lambda]}]
But this doesn't work, I get the same error. My Equations looks correct. There is an error or inconsistecy in my code?
Mathematica does not assume everything is Real or assume "obvious" domains for some of your variables. I am guessing that your analytical solution does do that at some key steps in the process.
I don't know what any of your assumptions are, but if I guess then
promptly returns
If you can provide the essential domain information then I am hoping that Mathematica will give you the desired solution, perhaps even better than my guessing.