# How to find the maximum of a function with several variables symbolically?

I want to maximize a function with respect to tau1, tau2, and alpha, and it is like the following:

V + β1 τ1 - α τ1^2 - β2 τ1^2 + \τ2 - 2 τ2^2 + α τ2^2


I know I can try solve for the partial derivatives with respect to the 3 variables and set them equal to 0, but alpha is linear in this function, and when I tried the following code, it returns a weird solution.

Simplify[Solve[D[π1 , τ1] == 0 && D[π1, τ2] == 0, D[π1, α] == 0, {τ1, τ2, α }]]


Since this function involves symbolic variable, V, and beta, I know I cannot go to the numerical route to find maximum, so what should I do then?

• There are syntax errors in your code. You put a comma in front of the last equation instead of &&. – Sjoerd Smit May 30 at 14:23
• i see thanks! So, it still makes sense to solve for alpha == 0 even thought the partial derivative of the pi1 is linear in alpha? – lll May 30 at 14:35
• are all variables ($\alpha, \tau_1, \tau_2$) and parameters $\beta_1$ and $\beta_2$ positive or can they take negative values? – kglr May 30 at 15:49
• yes, all these variables are positive – lll May 30 at 15:53

Looking at and thinking about, one finds

ClearAll[\[Alpha], \[Tau]1, \[Tau]2]; Maximize[V + \[Beta]1 \[Tau]1 - \[Alpha] \[Tau]1^2 -
\[Beta]2 \[Tau]1^2 + \\[Tau]2 -2 \[Tau]2^2 + \[Alpha] \[Tau]2^2 /. {\[Tau]1 ->
0, \[Alpha] -> \[Tau]2}, \[Tau]2]


{[Infinity],{[Tau]2->Indeterminate}}

Addition. Taking into account the comments of kglr and III done after my answer (French call such behavior l'esprit d'escalier), the same result is obtained by

ClearAll[\[Alpha], \[Tau]1, \[Tau]2]; Maximize[{V + \[Beta]1 \[Tau]1 \- \[Alpha] \[Tau]1^2 - \[Beta]2 \[Tau]1^2 + \[Tau]2 -
2 \[Tau]2^2 + \[Alpha] \[Tau]2^2, \[Beta]1 >= 0 && \[Beta]2 >= 0 &&
V >= 0} /. {\[Tau]1 -> 1/100, \[Alpha] -> \[Tau]2}, \[Tau]2]


$$\left\{ \begin{array}{cc} \{ & \begin{array}{cc} -\infty & \neg (\text{\beta 2}\geq 0\land \text{\beta 1}\geq 0\land V\geq 0) \\ \infty & \text{True} \\ \end{array} \\ \end{array} ,\{\text{\tau 2}\to \text{Indeterminate}\}\right\}$$