# Math Q: Calculus, Maximization / Optimization Problem

**URL:** <https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078>\
**Category:** Factual Questions\
**Created:** [July 25, 2017, 1:43pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078 "2017-07-25T13:43:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bullitt](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bullitt/32/5725_2.png) [@Bullitt](https://boards.straightdope.com/u/Bullitt)\
**Post date:** [July 25, 2017, 1:43pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/1 "2017-07-25T13:43:43Z")

</div>

Hi folks, I can sure use your help. A teen from my church is struggling with this problem, and he asked for my help. I am stumped. Can you solve this problem for me? With that solution, I will not give him the solution, but will be better able to lead him to it.

Problem: maximize the area of a rectangle bounded by the x-axis, the y-axis, and the line defined by the points (4,0) and (0,2).

Your help is much appreciated! I know we don’'t usually answer questions which we suspect to be someone’s homework. This isn’t – again, it’s for a teen who has asked for my help. And it has been many years since I did these type of problems.

Thank you!

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [July 25, 2017, 1:58pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/2 "2017-07-25T13:58:49Z")

</div>

Use Fermat’s theorem on stationary points: if f(x) is a real function defined on an open real interval that has a local extremum at a point c in the interval, and f is differentiable at c, then f’© = 0.

---

<div class="post-metadata">

**Author:** ![scr4](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@scr4](https://boards.straightdope.com/u/scr4)\
**Post date:** [July 25, 2017, 2:09pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/3 "2017-07-25T14:09:48Z")

</div>

Say _x_ is the width of the rectangle (x coordinate of the right edge of the rectangle). What is the height of the rectangle as a function of _x_?

Once you know that, you can write the area of the rectangle as a function of x.

Then you can plot that and show that it only has one maximum.

How do you find out where exactly the maximum is? Well, what is the derivative of this function with respect to x at that point?

---

<div class="post-metadata">

**Author:** ![md2000](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@md2000](https://boards.straightdope.com/u/md2000)\
**Post date:** [July 25, 2017, 2:10pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/4 "2017-07-25T14:10:46Z")

</div>

I assume what they are saying is - draw the line between those two points and then draw any rectangle you want where the top right corner touches the line - then figure the formula.  
The way I learned, y=mx+b where b is x=0 is y intercept, 2; m is slope, m=(x1-x2)/(y-y2)

So now you have a rectangle, (0,0) to (x,y) where x and y satisfy the line formula.  
Express the area as a formula A=f(x) and differentiate for f’(x) = 0  
(since x determines y you only have one variable)

---

<div class="post-metadata">

**Author:** ![DSYoungEsq](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@DSYoungEsq](https://boards.straightdope.com/u/DSYoungEsq)\
**Post date:** [July 25, 2017, 2:17pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/5 "2017-07-25T14:17:29Z")

</div>

A rectangle cannot be so bounded. The line from (4,0) to (0,2) is not parallel to either axis.

Presumably, the problem requires the maximization of a rectangle which is contained within the triangle specified. In other words, find a point on the line from (4,0) to (0,2) that acts as the vertex opposite (0,0).

---

<div class="post-metadata">

**Author:** ![OldGuy](https://avatars.discourse-cdn.com/v4/letter/o/3bc359/32.png) [@OldGuy](https://boards.straightdope.com/u/OldGuy)\
**Post date:** [July 25, 2017, 2:35pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/6 "2017-07-25T14:35:47Z")

</div>

> [@DSYoungEsq](#):
>
> A rectangle cannot be so bounded. The line from (4,0) to (0,2) is not parallel to either axis.

Of course it can be so bounded. If it could not be bounded, there would be no maximum size which is the point of the problem. In math a bound needn’t be tight. The sequence 1/2 3/4 7/8 … has an upper bound of 2 or 3 or 7. None of those is the least upper bound, but they are bounds.

---

<div class="post-metadata">

**Author:** ![Snarky\_Kong](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Snarky\_Kong](https://boards.straightdope.com/u/Snarky_Kong)\
**Post date:** [July 25, 2017, 3:08pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/7 "2017-07-25T15:08:43Z")

</div>

> [@scr4](#):
>
> Say _x_ is the width of the rectangle (x coordinate of the right edge of the rectangle). What is the height of the rectangle as a function of _x_?
> 
> Once you know that, you can write the area of the rectangle as a function of x.
> 
> Then you can plot that and show that it only has one maximum.
> 
> How do you find out where exactly the maximum is? Well, what is the derivative of this function with respect to x at that point?

Are you assuming that the sides of the rectangle are parallel wrt to the x and y axis?

That’s what I assumed initially, but I don’t know if it’s optimal. I think so, but not sure and not going to go through a multivariable optimization right now.

But yeah, if the bottom left corner is the origin, the upper right corner will be on the diagonal line and have coordinates (x,y). The height of the rectangle is y, the width is x, and the area is x\*y. Write y in terms of x and optimize.

---

<div class="post-metadata">

**Author:** ![Bullitt](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bullitt/32/5725_2.png) [@Bullitt](https://boards.straightdope.com/u/Bullitt)\
**Post date:** [July 25, 2017, 3:50pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/8 "2017-07-25T15:50:24Z")

</div>

Sorry, one side of the rectangle is on that line, (0,4), (2,0),. The rest of the rectangle lies below that line and within the x- and y- axes.

---

<div class="post-metadata">

**Author:** ![Bullitt](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bullitt/32/5725_2.png) [@Bullitt](https://boards.straightdope.com/u/Bullitt)\
**Post date:** [July 25, 2017, 3:51pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/9 "2017-07-25T15:51:25Z")

</div>

So, the rectangle sides are parallel and orthoginal to that line. Hope that helps.

---

<div class="post-metadata">

**Author:** ![Snarky\_Kong](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Snarky\_Kong](https://boards.straightdope.com/u/Snarky_Kong)\
**Post date:** [July 25, 2017, 4:17pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/10 "2017-07-25T16:17:06Z")

</div>

Same technique. Pick a corner and label it (x,y). Every other point is determined by the location of the first one. Two will be on the slope line, one on the x-axis, one on the y-axis. Write a function of the area given the x,y coordinates. Take derivate and set to zero.

---

<div class="post-metadata">

**Author:** ![Buck\_Godot](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/buck_godot/32/6573_2.png) [@Buck\_Godot](https://boards.straightdope.com/u/Buck_Godot)\
**Post date:** [July 25, 2017, 4:19pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/11 "2017-07-25T16:19:09Z")

</div>

> [@Bullitt](#):
>
> So, the rectangle sides are parallel and orthoginal to that line. Hope that helps.

Are you postiive that it is this way it is and that md2000 doesn’t have it right?

The problem you are posing is much harder and not what I would expect to see as a standard homework problem, although I could see it as an extra credit problem for motivated students.

Here is how you would do it.

Let one corner of the square be at (X,0)

based on this corner, you can find the next corner (0,Y) in terms of X by running a line from (X,0) parallel to the (4,0), (0,2) line until it hits the X axis.

The distance between these two points (in terms of X) will be the length of one side of the square. Next you find the distance between (X,0) and the (4,0), (0,2) line, using a [well known formula](https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line). That will give you the length of the second side (again in terms of X).

now multiply those two values together and you will get the area (in terms of X). Now take the derivative, set it equal to 0 to solve for X to find the maximal point. Plug it into your area equation and voila you get your answer.

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [July 25, 2017, 4:23pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/12 "2017-07-25T16:23:17Z")

</div>

> [@Bullitt](#):
>
> Sorry, one side of the rectangle is on that line, (0,4), (2,0),. The rest of the rectangle lies below that line and within the x- and y- axes.

It’s not hard, just pointing out that you cannot say that you can “obviously” assume one side of the rectangle lies along the line. This requires proof.

---

<div class="post-metadata">

**Author:** ![Snarky\_Kong](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Snarky\_Kong](https://boards.straightdope.com/u/Snarky_Kong)\
**Post date:** [July 25, 2017, 4:38pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/13 "2017-07-25T16:38:09Z")

</div>

> [@DPRK](#):
>
> It’s not hard, just pointing out that you cannot say that you can “obviously” assume one side of the rectangle lies along the line. This requires proof.

I don’t think he assumed, I think that’s the problem statement and he was just clarifying.

On my calculations I find the maximum area rectangle that is aligned with the coordinate axes is slightly larger than the one aligned with the sloped line. There may be another that’s skewed wrt to both that is larger, but I doubt that’s a question asked of a high school student.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [July 25, 2017, 4:38pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/14 "2017-07-25T16:38:28Z")

</div>

Given a rectangle bounded by an acute or right triangle, with one side of the rectangle along _any_ of the sides of the triangle, the maximum area is always going to be the same anyway, half the area of the triangle. The same result holds for an obtuse triangle, provided that the rectangle is along the long side.

EDIT: **Snarky\_Kong** , is one or both of your results greater than half the area of the triangle? What coordinates give you that?

---

<div class="post-metadata">

**Author:** ![Snarky\_Kong](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Snarky\_Kong](https://boards.straightdope.com/u/Snarky_Kong)\
**Post date:** [July 25, 2017, 4:47pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/15 "2017-07-25T16:47:29Z")

</div>

> [@Chronos](#):
>
> Given a rectangle bounded by an acute or right triangle, with one side of the rectangle along _any_ of the sides of the triangle, the maximum area is always going to be the same anyway, half the area of the triangle. The same result holds for an obtuse triangle, provided that the rectangle is along the long side.

Interesting. Must have been off a bit on my second calculation from rounding.

Is there a larger possible rectangle that doesn’t have a side on a side of the triangle?

_eta_ **Chronos** , no. For the one with a corner at the origin, I get an area of 2 with the opposite corner at (2,1). For the one with a side along the line I got an area of 1.97 with a corner at (~0.511,~1.745). Although I haven’t double checked my math on the second and seem to have an error somewhere.

---

<div class="post-metadata">

**Author:** ![naita](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/naita/32/5862_2.png) [@naita](https://boards.straightdope.com/u/naita)\
**Post date:** [July 25, 2017, 4:51pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/16 "2017-07-25T16:51:56Z")

</div>

So one side lies on the line between (0, 4) and (2, 0). You can trivially show that the end points of the parallell side is on the two axes. (Draw any rectangle that is valid by the rules and if the vertices are not on the axes it can obviously be enlarged by stretching until they are.)

So if we say that one vertex is on the x-axis at point (x, 0), then the point on the y-axis is at 2x, since the side we’re drawing is parallell to the line through (0, 4) and (2, 0).

Now you can find the area of this rectangle in various ways, for instance finding the length of the side with vertices on the axes and the distance between the two lines, but I think it’s more fun to observe that the rectangle in question has the same area as the parallellogram defined by (0, 2x), (x, 0), (2, 0) and ((2-x), 2x). And that parallellogram is equal to the trapeze (0, 2x), (0, 0), (2, 0), ((2-x), 2x) minus the triangle (0, 2x), (0, 0), (x, 0)

1/2\*(2+(2-x))_2x - 1/2_x\*2x  
So A(x) = 4x - x^2 - x^2 = 4x - 2x^2  
A’(x) = 4-4x  
A’(x) = 0 for x = 1

---

<div class="post-metadata">

**Author:** ![Snarky\_Kong](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Snarky\_Kong](https://boards.straightdope.com/u/Snarky_Kong)\
**Post date:** [July 25, 2017, 4:53pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/17 "2017-07-25T16:53:12Z")

</div>

I see my error now. Will work through it and see what corner I get.

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [July 25, 2017, 5:13pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/18 "2017-07-25T17:13:38Z")

</div>

Hint: to construct the desired rectangle(s), bisect the sides of the triangle.

---

<div class="post-metadata">

**Author:** ![Bullitt](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bullitt/32/5725_2.png) [@Bullitt](https://boards.straightdope.com/u/Bullitt)\
**Post date:** [July 25, 2017, 5:40pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/19 "2017-07-25T17:40:09Z")

</div>

> [@DPRK](#):
>
> Hint: to construct the desired rectangle(s), bisect the sides of the triangle.

This does not give one side of the rectangle on the sloped line, right?

---

<div class="post-metadata">

**Author:** ![Bullitt](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bullitt/32/5725_2.png) [@Bullitt](https://boards.straightdope.com/u/Bullitt)\
**Post date:** [July 25, 2017, 5:41pm UTC](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078/20 "2017-07-25T17:41:41Z")

</div>

> [@Snarky\_Kong](#):
>
> I don’t think he assumed, I think that’s the problem statement and he was just clarifying.

Correct, that’s what I was doing.

[Next page](https://boards.straightdope.com/t/math-q-calculus-maximization-optimization-problem/792078.md?page=2)
