# Curvilinear integral along a line segment

1. Feb 9, 2016

### Gianmarco

1. The problem statement, all variables and given/known data

Calculate the curvilinear integral ∫C (x2 + y2)ds where C is the line segment [0,0] → [3,4].
Then calculate the maximum M of x2 + y2 along the segment and verify that the inequality
C (x2 + y2)ds ≤ M*length(C)
holds.

2. Relevant equations
ds = (x'(t)2 + y'(t)2)½dt
∇f(x,y) = λ∇g(x,y)
g(x,y) = 0
3. The attempt at a solution
I parametrized the segment as C = (3t, 4t) , 0≤t≤1.
So x'(t) = 3, y'(t) = 4 and ds = 5dt with the formula given above.
After plugging in and factoring out the 5, the integral becomes:
5∫01(9t2 + 16t2)dt = 125/3.
I then proceeded to calculate the maximum along the segment using lagrange multipliers:

equating the partial derivatives of x2 + y2 with the partial derivatives of g, I got:
2x = λ4/3
2y=-λ
The constraint given by the segment is:
g(x,y) = 4/3x - y = 0
By solving this system of 3 unknowns, I got the point (0,0) which plugged into the original equation gives 0 and the inequality does not hold. Is my reasoning correct and did I just miscalculate something or am I doing some conceptual error?

2. Feb 9, 2016

### Samy_A

In using the Lagrange multipliers method to find the maximum, you are actually looking for an extremum (maximum or minimum) of x²+y² on the line 4x-3y=0.
Nowhere do you take into account that you only want to consider points on the line segment from (0,0) to (3,4). That's why you find (0,0) as solution, the obvious minimum point for x²+y² on the line 4x-3y=0.

You don't need Lagrange multipliers method to find the maximum, it's much easier than that.

3. Feb 9, 2016

### Gianmarco

Thank you, I think I got it right this time. The function is always positive and increasing, so the maximum will be at the point [3,4]. The inequality is then 125/3 ≤ (32 + 42)*(32 + 42)½=125.
I would like to ask you something though. In this case we were dealing with a simple function, so it was easy to draw qualitative conclusions about its behaviour and find its maximum along the segment. But if the function was more complicated, would there be a systematic approach at finding its extrema along a segment?

4. Feb 9, 2016

### Samy_A

As you parametrized the segment with the variable t (0≤t≤1), isn't this basically looking for an extremum of a function? If the derivative doesn't give an extremum on the segment, check the values for t=0 and t=1 (or whatever begin and end values you have chosen). In the present case, the two endpoints yield the extreme values, minimum at (0,0) (corresponding to t=0), maximum at (3,4) (corresponding to t=1).

5. Feb 9, 2016

### Gianmarco

I see what you are saying. Thanks a lot for your help :)

6. Feb 9, 2016

### Ray Vickson

When you have inequality constraints present you cannot necessarily set derivatives to zero. Let me illustrate by using your example, in several forms. Your problem is to maximize $f = f(x,y) = x^2 + y^2$ on the segment joining (0,0) to (3,4).

By far the easiest way in this case is to put (as you did) $(x,y) = (3t,4t), 0 \leq t \leq 1$. That gives $f = 25 t^2$, whose maximum on $t \in [0,1]$ is obviously at $t = 1$. Note, though, that the derivative is not zero at that point; that is due to the effect of having an inequality constraint.

Another, harder, way, is what you also tried, which was to maximize $f$ subject to the constraint $g = (4/3)x - y = 0$. To respect the endpoints, we also need inequality constraints, which we can take as $0 \leq x \leq 3$. Thus, you have a problem with mixed equality and inequality constraints:
$$\begin{array}{rl}\max f =& x^2 + y^2 \\ \text{s.t.} \:\: g = & (4/3) x - y = 0 \\ & x \geq 0, x \leq 3 \end{array}$$
Construct a Lagrangian: $L = f - u g = x^2 + y^2 - u((4/3)x - y)$; here, I have used "$u$" instead of "$\lambda$", just because it is easier to type (and, anyway, is often used in the Optimization literature). Since $y$ has no explicit inequality constraint, but $x$ does, we need to be careful when writing the optimality conditions. Letting $L_x \equiv \partial L / \partial x$ and $L_y = \partial L / \partial y$, the conditions for a maximum at $(x,y)$ are:
$$\begin{array}{ccll} L_x \leq 0 &\text{if}& x = 0 & \cdots (1)\\ L_x \geq 0 &\text{if} & x = 3 & \cdots (2) \\ L_x = 0 & \text{if} & 0 < x < 3 & \cdots (3)\\ L_y = 0 && &\cdots(4)\\ g(x,y) = 0 && & \cdots(5) \end{array}$$
(For a minimization problem, the $L_x$ inequalities would be swapped.)
As you noted, setting $L_x = 0, L_y = 0, g = 0$ gives $(x,y,u) = (0,0,0)$, and this does satisfy (1), (4), (5); however, it would also satisfy the conditions with the inequalities on $L_x$ swapped, so it satisfies conditions for both a constrained max or a constrained min. (It turns out that second-order necessary conditions reject the maximization characteristic, so it is actually a constrained minimum.)

So, if we apply the conditions for $0 < x < 3$ we obtain $x = 0$, but there is no inconsistency in this case. The only other candidate is $x = 3$, where the conditions are that $x = 3, L_y = 0 = 2y+u$, so $(x,y) = (3,-u/2)$. Putting that into $g = 0$ we get $u = -8$ and hence $(x,y) = (3,4)$. All the conditions (2), (4) and (5) are satisfied. Note also that at $(x,y,u) = (3,4,-8)$ we have $L_x = 50/3$, which is certainly not anywhere near 0.

7. Feb 10, 2016

### Gianmarco

Hello Ray, your answer was very thorough. I had never worked with inequality constraints in lagrange multipliers before so thank you for showing me how it's done.