# Minimize function / Find α resulting in lowest value for formula

I think it's called minimizing a function, but I'm not sure. What I want is to find the value of $\alpha$ so that the result of the formula (the formula on the right side of the equal symbol) will be the lowest value possible.

\begin{align} V(\alpha) = {} & \alpha^2 x_1 + (1-\alpha)^2 x_2 + 2\alpha(1-\alpha)x_3 \end{align}

I do already know the values of $x_1, x_2$ and $x_3$. These values are fixed. By using statistics software, I was able to calculate both the value of $\alpha$ and the result of the formula when said $\alpha$ is inserted into the formula. However, it would be nice to know how to solve this by hand/formulas.

I have been trying to search around for a while now, and even though there's many examples to find, I'm stuck.

Could anyone point me in the right direction or show me how it's done step by step?

Thank you.

• what set can it be in? that may help. – user451844 Aug 2 '17 at 14:04
• Alpha can be between 0 and 1. But how do I continue from there? I was thinking there must be a way to calculate it instead of trying a lot of possibilities. – A. Jakobsen Aug 2 '17 at 14:07

Notice that $V(\alpha)$ is quadratic in $\alpha$ - you have an $\alpha^{2}$ term, a $(1-\alpha)^{2}=\alpha^{2}-2\alpha+1$ term, and a $\alpha(1-\alpha)=\alpha-\alpha^{2}$ term. So you can complete the square, then set the squared term to zero. However, this will only give you a minimum if the squared term's coefficient is positive.

You can also solve it via calculus, like DMcMor did. In general calculus is the way to go, but for quadratics completing the square is a nice alternative.

$V(\alpha) = (x_{1}+x_{2}-2x_{3})\alpha^{2} - (2x_{2}-2x_{3})\alpha + x_{2} = a(\alpha - b)^{2} + c$ where $a = x_{1}+x_{2}-2x_{3}$, $b = (x_{2}-x_{3})/a$ and $c = x_{2} - ab^{2} = (x_{1}x_{2} - x_{3}^{2})/a$. Only if $a>0$ will you actually get a minimum, in which case you have $\alpha = b$ and $V(\alpha_{min})=c$.

EDIT:

Since OP has stated $\alpha$ is restricted to the interval $[0,1]$ (correct me if the interval is not closed), it might be the case that the minimum obtained by either this method or calculus will lie outside that interval. In this case, one would pick the value that is as close as possible to that minimum - say you got $1.5$, you would choose $\alpha=1$. If you got $-0.5$, you'd pick $\alpha=0$. You can do this because a quadratic is monotonic either side of its turning point. In fact, if you don't find any turning points in the allowed interval, the function must be monotonic if it is continuous, so the minimum in that interval must be one of the two endpoints (and it's usually simple to determine which).

• Hi. So as I understand your answer, if α is bigger than 1 or less than 0, it is not always the case that you just pick the value that is as close as possible? In other words, if α = 1.5, do you always pick α = 1 and if α = -0.5 do you always pick α = 0? – A. Jakobsen Aug 4 '17 at 13:18
• In this case you do pick the closest one, because of the way your function behaves. As you go away from the minimum, in either direction, $V$ keeps on increasing. But it depends entirely on your function. For an example, plot out $xe^{-x^{2}/2}$ using something like Mathematica or Wolfram Alpha. Say you're trying to minimise subject to $x \in [1,2]$. If you look at the graph, it's obvious that the minimum is at $2$. But the global minimum is at $-1$, which is closer to $1$. The reason for that discrepancy is because there's another turning point at $x=1$ (tbc.) – T. Linnell Aug 4 '17 at 13:29
• Basically, what I'm saying is: in this case, you pick the point nearer to the global minimum. For quadratics, you can do that. But not in general. In general, I'd go with calculus as it's more versatile, and also try to sketch your function too. I've been caught out numerous times before when I've just gunned in without drawing out my function, whereas a simple sketch (doesn't have to be pinpoint accurate) has made solving these kinds of problems much easier. – T. Linnell Aug 4 '17 at 13:36
• Thank you for your comments. Sorry if I sound a bit confused. So for your answer, I'll pick the nearest. What about with calculus, if we look at DMcMor's and Xander Henderson's answers. Xander Henderson wrote, that it would be one of the endpoints. So in that case, I should evaluate V(0) and V(1) and pick the smallest? – A. Jakobsen Aug 4 '17 at 14:42
• Yeah, it doesn't really matter which method you use, because the function is the same. – T. Linnell Aug 4 '17 at 14:45

Take the derivative: \begin{align*} V'(\alpha) &= 2\alpha x_{1} - 2(1-\alpha)x_{2} + 2(1-\alpha)x_{3} -2\alpha x_{3}\\ &=2\alpha x_{1} - 2x_{2} + 2\alpha x_{2} + 2x_{3} - 2\alpha x_{3} - 2\alpha x_{3}\\ &=2\alpha(x_{1}+x_{2}-2x_{3}) -2(x_{2}-x_{3}). \end{align*}

Set $V' = 0$ and solve for $\alpha$:

$$0 = 2\alpha(x_{1}+x_{2}-2x_{3}) -2(x_{2}-x_{3}).$$

This yields

$$\alpha = \frac{x_{2}-x_{3}}{x_{1}+x_{2}-2x_{3}}.$$

At this point you need to verify that this particular $\alpha$ is in fact a local minimum, and as was pointed out in the comments you need to also check the boundary of whatever set $\alpha$ belongs to.

• It seems like I'm not getting the correct result by using the formula for alpha you've written. When I insert the alpha, calculated with your formula, into the equation I get a value that is close to the lowest, but still not the lowest. What could be wrong? – A. Jakobsen Aug 2 '17 at 14:23
• What are $x_1, x_2, x_3$? It's possible that this value of $\alpha$ is outside the given internal. – DMcMor Aug 2 '17 at 14:28
• Nevermind, sorry! Your formula gives the correct result! My fault! – A. Jakobsen Aug 2 '17 at 14:34

This should be possible as an application of Fermat's theorem, which states that the derivative of a differentiable function is zero at (local) extreme values. Since $x_1$, $x_2$, and $x_3$ are constant, $V$ is a polynomial in $\alpha$, and so we can differentiate in order to obtain \begin{align} V(\alpha) &= \alpha^2 x_1 + (1-\alpha)^2x_2 + 2\alpha(1-\alpha)x_3 \\ &= (x_1 + x_2 -2x_3) \alpha^2 + (-2x_2+2x_3) \alpha + x_2. \\ \implies V'(\alpha) &= 2(x_1+x_2-2x_3) \alpha + 2(x_3 - x_2). \end{align} Setting this equal to zero and solving, we get $$\alpha = \frac{2(x_2 - x_3)}{2(x_1+x_2-2x_3)} = \frac{x_2 - x_3}{x_1+x_2-2x_3}.$$ Since $V$ is quadratic in $\alpha$, this will be a global minimum if the leading coefficient $x_1+x_2-2x_3 > 0$, and a global maximum if $x_1+x_2-2x_3 < 0$.

In a comment, you specified that you are looking for the minimum on the interval $[0,1]$. If the leading coefficient is positive, and if $\alpha$ ends up in that interval (i.e. if $0 \le \alpha \le 1$), then you are done---the minimum value of $V$ is achieved at $\alpha$. However, if the leading coefficient is negative, or if $\alpha$ is not between 0 and 1, then the minimum value of $V$ will be achieved at one of the endpoints. So, evaluate $V(0)$ and $V(1)$, and take the smallest.

In general, if $f : [a,b] \to \mathbb{R}$ is a differentiable function, the the minimum value of $f$ is found as follows:

(1) Apply Fermat's Theorem: First, solve $f'(x) = 0$. You may get multiple solutions. Each solution gives you a "critical point."

(2) Evaluate $f$ at each of the critical points, and at the endpoints of the interval (i.e. at $a$ and at $b$).

(3) The minimum of $f$ will be the smallest value that you found in step (2).

• Your condition for the nature of the stationary point is wrong. The stationary point is a local minimum (global in this case since $V$ is quadratic) if $V''>0$, and $V''(\alpha) = 2(x_{1}+x_{2}-2x_{3})$, so the condition to have a minimum is actually $x_{1}+x_{2}-2x_{3}>0$. – T. Linnell Aug 2 '17 at 14:14
• Oi... I wasn't being careful, and was looking at the wrong line of displayed math. I'll fix it. Thanks. – Xander Henderson Aug 2 '17 at 14:15
• I'm getting an alpha value resulting in the equation having a value close to the lowest value, but still not the lowest. Just as with DMcMor's formula. Of course, your formulas result in the same. But what could be wrong? – A. Jakobsen Aug 2 '17 at 14:27
• Well, you said that you want to minimize the function in the interval $[0,1]$. This gives you a global minimum, but there is no guarantee that the global minimum will be in that interval. If $\alpha\not\in[0,1]$, then the minimum will occur at either 0 or 1. I'll change my answer to reflect this. – Xander Henderson Aug 2 '17 at 14:30
• Nevermind, sorry! Your formula gives the correct result! My fault! – A. Jakobsen Aug 2 '17 at 14:34