If the sum of two numbers is k. Find the minimum value of the sum of their squares.

This is my calculations so far.

a + b = k                <-- google says that I should put x + y = k rather than a + b = k
a² + b² = y                  (but I don't know why should I do that)
(k - b)² + b² = y
k² - 2kb + 2b² = y       <-- now I'm stuck here. I don't know which differentiation variable to take. If it is 'b' then why?

So here I am. Kindly show me how to solve the problem and where did I go wrong in my computations :P

  • $\begingroup$ Welcome to Mathematics Stack Exchange! Can you please provide a more precise statement of your problem? For example, what is the domain of these two numbers? Do they have to be positive? Are they integers or real numbers? $\endgroup$
    – Fikilis
    May 23 at 0:15
  • 1
    $\begingroup$ Different approach... If $a+b=k$ then $(a+b)^2=a^2+2ab+b^2=k^2$ and $a^2+b^2=k^2-2ab$. To minimize the sum of the squares, you would need to maximize the value of $2ab$... $\endgroup$
    – abiessu
    May 23 at 0:19
  • $\begingroup$ @arisneilmacalindong FYI, for the more general case of a sum of $n$ non-negative numbers to a fixed value, see How to prove the sum of squares is minimum?. $\endgroup$ May 23 at 1:39
  • $\begingroup$ I don't know why you said "google says you should ..." It doesn't. Maybe some people (wrongly) do. The point is, if you let $a,b$ be the two numbers, then $a+b = k$. If you instead used variables "$x,y$", then you would get "$x+y = k$". But please don't just try to use differentiation without understanding what is the conclusion you can get from the derivative. Also, for subsequent posts please use MathJax. But anyway, welcome to Math SE! $\endgroup$
    – user21820
    May 23 at 8:22

4 Answers 4


Very simple approach:

You know $a + b = k$. So $$(a+b)^2 = a^2 + 2ab + b^2 = k^2.$$ If you could somehow remove the $2ab$ term, then you'd have the desired sum of squares. Well, you also know that $$(a-b)^2 = a^2 - 2ab + b^2,$$ so if you add the two together, you'd get

$$(a+b)^2 + (a-b)^2 = 2a^2 + 2b^2 = k^2 + (a-b)^2.$$

Therefore, $$a^2 + b^2 = \frac{k^2 + (a-b)^2}{2}.$$

Now, $k$ is a constant, and $(a-b)^2$, being the square of a real number, is never negative, so the right hand side is minimized when you can make $a-b = 0$, and the minimum value attained is $k^2/2$.


Hint: $x^2+y^2 \ge \dfrac{(x+y)^2}{2}$.


I focus on a method given your tags on the question. We are given $a + b = k$. The sum of their squares is given by $a^2 + b^2$. Since $a + b = k$, we hat that $k - b = a$, hence $$g(b) = a^2 + b^2 = (k-b)^2 + b^2 = k^2-2kb+b^2+b^2 = k^2 - 2kb + 2b^2\text{.}$$ $k$ is a fixed value that is known, so $b$ is the only unknown in the expression above. Differentiating the above expression with respect to $b$ and setting that equal to $0$, we obtain $$g^{\prime}(b) = -2k + 4b = 0$$ or $$4b = 2k \implies b = \dfrac{2}{4}k = \dfrac{k}{2} \text{.}$$ Since $b = \dfrac{k}{2}$ and $a + b = k$, it follows that $$a = k - b = k - \dfrac{k}{2} = \dfrac{k}{2}\text{.}$$ Hence from setting the derivative equal to $0$, we obtain $a = b = \dfrac{k}{2}$.

Next, we must demonstrate that this solution is a minimum. We have $$g^{\prime\prime}(b) = 4 > 0$$ for any $b$, hence by the second derivative test, the solution $a = b = \dfrac{k}{2}$ must be a minimum.

Thus, the desired sum of squares is given by $$a^2 + b^2 = \left(\dfrac{k}{2}\right)^2 + \left(\dfrac{k}{2}\right)^2 = 2 \cdot \dfrac{k^2}{4} = \dfrac{k^2}{2}\text{.}$$


Let $k = x + y$. This implies that $y = k - x$. The sum of their squares is $x^2 + y^2$, which can be written as $x^2 + (k - x)^2$. Since we are trying to to find the minimum value of this expression for all $x$, we must first determine for what $x$ values this expression's derivative (w.r.t. $x$) changes from negative to positive.

Set this expression equal to $f(x)$ and find $f'(x)$ and $f''(x)$:

$f(x) = x^2 + (k-x)^2$

$f'(x) = 2x - 2(k - x)$.

$f''(x) = 4$

To determine when $f'(x)$ changes from negative to positive on a quadratic (or any "non-linear" function), test for the condition $f'(x) = 0 \land f''(x) > 0$.

$f'(x) = 0 \equiv 0 = 2x - 2(k - x)$; $0 = 2x - 2k + 2x$; $2k = 4x$; $x = \frac{k}{2}$.

$f''(x) > 0 \equiv 4 > 0$, which is true regardless of the value of $x$.

Therefore, $f(x)$ has a relative minimum at $x = \frac{k}{2}$.

To find the global minimum, find the minimum value of the relative minimums of $f$ and $f$ evaluated at it's given bounds (if they are given). Since bounds are not given, test if $f(x)$ as $x \to \infty$ or $x \to - \infty$ are less than the candidate $\frac{k}{2}$. $f(x)$ is merely a sum of two squares, thus the limit must approach $\infty$. Therefore, as the only possible case, $\frac{k}{2}$ is the global minimum value of $x^2 + y^2$ given two numbers $x$, $y$ s.t. $x + y = k$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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