TITLE: Finding maximum of a function with an ellipse constraint
QUESTION [0 upvotes]: I'm trying to find the maximum of a function $f = a^T\mu$ where a is a vector when we have a constraint of the form:
$$g(\mu) = n\mu^T S^{-1}\mu - C = 0$$
where C is a fixed constant, $S^{-1}$ is a fixed matrix , $n$ is a number and $\mu$ is a vector of variables. In fact, my goal is to find a $\mu$ that satisfies $g(\mu)$ and at the same time, maximizes f.
I thought of using Lagrange multipliers but I'm stuck and I appreciate if you can help me solve this problem. Below is what I've done so far:
define: $L = f(\mu) - \lambda g(\mu)$. Then we have:
$\frac{\partial L}{\partial \mu} = a^T - 2 \lambda n \mu^TS^{-1} = 0 \rightarrow \mu^T = \frac{a^TS}{2\lambda n}$
$\frac{\partial L}{\partial \lambda} = g(\mu) = 0$
I don't know how to proceed. Like I don't know how to get rid of lambda in the expression 
$\mu^T = \frac{a^TS}{2\lambda n}$ I derived above.
Thanks very much for your help.

REPLY [1 votes]: To get the dual function, you want to plug in the optimal value of $\mu^*$:
$$
D(\lambda) = \max_\mu f(\mu) - \lambda g(\mu) = \frac{a^T S a}{4 n \lambda} + C\lambda
$$
Then you minimize this dual function to find the optimal $\lambda$.
$$
\frac{\partial D}{\partial \lambda} = -\frac{a^T S a}{4 n \lambda^2} + C
$$
$$
\lambda^* = \sqrt{\frac{a^T S a}{4 n C}}
$$
Plugging this back in to the formula for $\mu^*$ gives:
$$
\mu^* = \sqrt{\frac{C}{n (a^T S a)}}Sa
$$
{"set_name": "stack_exchange", "score": 0, "question_id": 572825}