Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to math. How to approach the following problem?

$\min_{a,b} \sum_{t=1}^N (-4aX_t\sin(Z_tb) -4aY_t\cos(Z_tb)+a^2Z_t^2 + X_t^2 + Y_t^2)$

where $X_t,Y_t,Z_t$ for $t\in \{1,...N\}$ are given. Say $N$ is around 800.

Do I need software? Which? I am not having luck with simple optim() in R, but maybe I am using wrong parameters.

Would this be a problem that could be solved in Mathematica? (I don't have access to Mathematica, and am also not familiar with it. I just heard that it is powerful.)

share|cite|improve this question
up vote 0 down vote accepted

With a little bit of work you can convert your two-dimensional minimization problem into a one-dimensional root-finding problem.

Call the quantity to be minimised $L(a,b)$. Then computing the partial derivatives and setting to zero gets you

$$\frac{\partial L}{\partial a} = 0 \;\Rightarrow\; \frac{a}{2} \sum_{t=1}^n Z_t^2 - \sum_{t=1}^N X_t\sin(Z_tb) + Y_t\cos(Z_tb) = 0$$

$$\frac{\partial L}{\partial b} =0 \;\Rightarrow\; a \sum_{t=1}^N X_t\cos(Z_tb) - Y_t\sin(Z_tb) = 0$$

and hence either $a=0$ or the sum in the second equation is zero. If you can find $b$ such that the sum is zero (using some numerical root finder) then $a$ is determined by the first equation. On the other hand, if $a$ is zero then you determine $b$ from the first equation using a numerical root finder.

share|cite|improve this answer
Thanks for your reply. It is still not clear for me: How do I find the global minimum? – Frank Seifert May 27 '11 at 12:58
Global minimization is a difficult problem in general. The extremal points of your equation are given by the solutions to the two equations in my answer. This will find all local maxima, minima and saddle points. To find the global minimum you should take those solutions and put them back into your original expression to find out which one gives the smallest result. – Chris Taylor May 27 '11 at 13:22
Thanks, had hoped there was some way to avoid this. – Frank Seifert May 27 '11 at 13:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.