Lagrange multipliers with a summation function and constraint

skatenerd

Active member
Problem stated: Let $$a_1, a_2, ... , a_n$$ be $$n$$ positive numbers. Find the maximum of
$$\sum_{i=1}^{n}a_ix_i$$ subject to the constraint $$\sum_{i=1}^{n}x_i^2=1$$.
I honestly have not much of an idea of how to go about solving this. If I use lagrange multipliers which I think I am supposed to since this problem is from that section of the book, how would I even begin to take partial derivatives of these summations, let alone solve a system of equations with them? Any hint on how to begin this would be appreciated. Thanks

Klaas van Aarsen

MHB Seeker
Staff member
Re: lagrange multipliers with a summation function and constraint

Problem stated: Let $$a_1, a_2, ... , a_n$$ be $$n$$ positive numbers. Find the maximum of
$$\sum_{i=1}^{n}a_ix_i$$ subject to the constraint $$\sum_{i=1}^{n}x_i^2=1$$.
I honestly have not much of an idea of how to go about solving this. If I use lagrange multipliers which I think I am supposed to since this problem is from that section of the book, how would I even begin to take partial derivatives of these summations, let alone solve a system of equations with them? Any hint on how to begin this would be appreciated. Thanks
Hi skatenerd!

Suppose you had to maximize $ax+by$ subject to the constraint $x^2+y^2=1$.
Would you know how to do that?

If so, how about $ax+by+cz$?

The time to generalize is after that.

MarkFL

Staff member
I noticed several guests viewing this topic, and thought I might go ahead and solve it, since time has gone by and it is interesting.

We have the objective function:

$$\displaystyle f\left(x_1,x_2,x_3,\cdots,x_n \right)=\sum_{k=1}^n\left(a_kx_k \right)$$

Subject to the constraint:

$$\displaystyle g\left(x_1,x_2,x_3,\cdots,x_n \right)=\sum_{k=1}^n\left(x_k^2 \right)-1=0$$

Using Lagrange multipliers, we obtain the system:

$$\displaystyle a_1=2\lambda x_1$$

$$\displaystyle a_2=2\lambda x_2$$

$$\displaystyle a_3=2\lambda x_3$$

$$\displaystyle \vdots$$

$$\displaystyle a_n=2\lambda x_n$$

This implies:

$$\displaystyle x_k=\frac{a_k}{a_1}x_1$$ where $$\displaystyle k\in\{2,3,4,\cdots,n\}$$

And so the constraint yields (taking the positive root since we are asked to maximize the objective function):

$$\displaystyle \sum_{k=1}^n\left(x_k^2 \right)=1$$

$$\displaystyle \sum_{k=1}^n\left(\left(\frac{a_k}{a_1}x_1 \right)^2 \right)=1$$

$$\displaystyle \left(\frac{x_1}{a_1} \right)^2\sum_{k=1}^n\left(a_k^2 \right)=1$$

$$\displaystyle x_1^2=\frac{a_1^2}{\sum\limits_{k=1}^n\left(a_k^2 \right)}$$

Taking the positive root, we then have:

$$\displaystyle x_1=\frac{a_1}{\sqrt{\sum\limits_{k=1}^n\left(a_k^2 \right)}}$$

Hence:

$$\displaystyle x_k=\frac{a_k}{\sqrt{ \sum\limits_{k=1}^n\left(a_k^2 \right)}}$$

And so we find:

$$\displaystyle f_{\max}=\sum_{k=1}^n\left(a_k\frac{a_k}{\sqrt{ \sum\limits_{k=1}^n\left(a_k^2 \right)}} \right)=\frac{\sum\limits_{k=1}^n\left(a_k^2 \right)}{\sqrt{ \sum\limits_{k=1}^n\left(a_k^2 \right)}}=\sqrt{ \sum\limits_{k=1}^n\left(a_k^2 \right)}$$

skatenerd

Active member
Wow, I think I completely forgot that I asked this question! This was in regard to my 3rd semester of calculus last year...Thanks for the responses and the solution MarkFL! Very cool indeed.