# Basics: find maxima

I'm completely new to Mathematica and recently tried to maximize the function x^(1-a)*(v-x)^a with respect to x under the constraints 1>a>0 and v>=x>=0.

As far as I know the maximum should be at x=v-av.

Maximize[{x^(1 - a) (v - x)^a , 1 > a > 0 && v >= x >= 0}, x]


I'd be grateful if someone can explain me why, and how the command should look like if I want to get a result with one command.

• You could try to find the zeros of the first derivative ... – b.gates.you.know.what Aug 3 '16 at 15:24
• I know that I can do: D[x^(1-a)*(v-x)^a], x] and then Solve[-a (v - x)^(-1 + a) x^(1 - a) + (1 - a) (v - x)^a x^-a == 0 && 1 >= a >= 0 && v >= x >= 0, x, Reals] But I'd like to know why "Maximize" does not work. I feel like this is fundamental. – Manuel Aug 3 '16 at 15:28
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Aug 3 '16 at 15:31
• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. You may also find this meta Q&A helpful – Michael E2 Aug 3 '16 at 15:31
• Have you asked Wolfram about it? As you say, it seems fundamental. – Michael E2 Aug 3 '16 at 15:52

Maximize[] and like functions often have problems with variable or non-integer exponents.

Even simple functions of the like fail.

But there's nothing wrong with remembering our high-school algebra. There are always going to be cases where we need human interaction (luckily) This function only has a maximum

Manipulate[Plot[x^(1 - a) (v - x)^a, {x, 0, v}], {a, 0, 1}, {v, 1, 4}] Remember, the maximum can be found when the derivative is zero:

Reduce[D[x^(1 - a) (v - x)^a, x] == 0]


a v (v - a v)^a != 0 && x == v - a v

In other words, $x=v-a v$

Manipulate[
Show[Plot[x^(1 - a) (v - x)^a, {x, 0, v}],
Graphics[{Red, Dashed, Line[{{v - a v, 0}, {v - a v, 2}}]}]], {a, 0,
1}, {v, 1, 4}] • Thank you Feyre! Unfortunately I have a follow-up question :) In the example I chose a simple function. How should I proceed if it gets a bit more complicated? For example: $$\max_{x_1} x_1^{(1-\alpha)}*x_2^{\alpha/2}*x_3^{\alpha/2} \: \textrm{s.t.} \: v=x_1+x_2+x_3; \alpha \in [0;1]; x_1,x_2,x_3\in [0;v]$$ I think (please correct me if I'm wrong) this should have the same maximum as before because at maximum $x_2=x_3$. But assume we don't know that. With Reduce[D[x1^(1 - a)*(v - x1 - x3)^(a/2)*(v - x1 - x2)^(a/2), x1] == 0, x1] Mathematica does not give me $x = v - a v$ as solution. – Manuel Aug 3 '16 at 17:23
• And what if the optimization problem gets even more complicated? Is there no way to maximize if the exponents are non-integer? – Manuel Aug 3 '16 at 17:35
• @Manuel Even very simple functions can't be maximized then. If you can't use numeric functions, unfortunately I think you just need to work these out. Try Reduce[-(1/2) a x1^(1 - a) (v - x1 - x2)^( a/2) (v - x1 - x3)^(-1 + a/2) - 1/2 a x1^(1 - a) (v - x1 - x2)^(-1 + a/2) (v - x1 - x3)^( a/2) + (1 - a) x1^-a (v - x1 - x2)^(a/2) (v - x1 - x3)^(a/2) == 0] Then solve for x1 – Feyre Aug 3 '16 at 17:46