14

Day 14

Lhopitals Rule And Optimization


L'Hôpital's Rule: 0/0 and ∞/∞ Forms

Direct substitution sometimes gives an indeterminate answer like 00\frac{0}{0} that carries no real information on its own. L'Hôpital's Rule replaces the whole fraction with the ratio of the derivatives — often collapsing what looked like an impossible limit into an easy one.

Core Theorem
Suppose f(a)=g(a)=0f(a)=g(a)=0 (or both ±\to \pm\infty), and g(x)0g'(x) \neq 0 near aa. Then limxaf(x)g(x)=limxaf(x)g(x)\lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{x \to a} \frac{f'(x)}{g'(x)}, provided the right-hand limit exists.
This holds for
xax \to a, xa+x \to a^+, xax \to a^-, xx \to \infty, and xx \to -\infty alike. If the new limit is STILL 00\frac{0}{0} or \frac{\infty}{\infty}, apply the rule again.
Watch the TikTok ExplanationL'Hôpital's Rule

Worked Examples

Read these first — the full solution is shown, with the reasoning behind each move.

Worked Example 01Easy
Evaluate limx03xsinxx\lim_{x \to 0} \dfrac{3x-\sin x}{x}.
How to think about it

Key idea: Confirm it's 00\frac{0}{0} first, then differentiate numerator and denominator separately.

Full solution

1. Step 1: Confirm the Indeterminate Form

At x=0x=0: 3(0)sin(0)0=00\frac{3(0)-\sin(0)}{0} = \frac{0}{0}.

2. Step 2: Apply L'Hôpital's Rule

limx03cosx1\lim_{x \to 0} \frac{3-\cos x}{1}.

3. Step 3: Evaluate

3cos(0)1=311=2\frac{3-\cos(0)}{1} = \frac{3-1}{1} = 2.
Worked Example 02Medium
Evaluate limx01cosxx2\lim_{x \to 0} \dfrac{1-\cos x}{x^2}.
How to think about it

Key idea: You may need to apply L'Hôpital's Rule more than once.

Full solution

1. Step 1: Confirm 0/0 and Apply L'Hôpital's Once

00    limx0sinx2x\frac{0}{0} \implies \lim_{x \to 0} \frac{\sin x}{2x}.

2. Step 2: Still 0/0 — Apply Again

limx0sinx2x\lim_{x \to 0} \frac{\sin x}{2x} is again 00\frac{0}{0}, so differentiate once more: limx0cosx2\lim_{x \to 0} \frac{\cos x}{2}.

3. Step 3: Evaluate

cos(0)2=12\frac{\cos(0)}{2} = \frac{1}{2}.
Step-by-Step SOP
  1. 1

    Confirm 0/0 or ∞/∞ by Direct Substitution

    Plug in the limiting value first to verify the indeterminate form actually applies.
  2. 2

    Differentiate Numerator and Denominator Separately

    Find f(x)f'(x) and g(x)g'(x) independently, then form the new ratio f(x)g(x)\frac{f'(x)}{g'(x)}.
  3. 3

    Re-evaluate, and Repeat If Needed

    Substitute again. If still indeterminate, differentiate again — as many times as it takes.

Practice — Your Turn

Try each one before opening the hint or the solution.

Practice 01Medium
Evaluate limxexx2\lim_{x \to \infty} \dfrac{e^x}{x^2}.
Need a hint?
This is \frac{\infty}{\infty} — you'll need L'Hôpital's Rule twice before the exponential 'wins.'
Show solution

1. Step 1: Confirm ∞/∞ and Apply L'Hôpital's

limxex2x\lim_{x \to \infty} \frac{e^x}{2x} — still \frac{\infty}{\infty}.

2. Step 2: Apply Again

limxex2\lim_{x \to \infty} \frac{e^x}{2}.

3. Step 3: Conclude

As xx \to \infty, exe^x \to \infty, so the limit is \infty — confirming that exponentials grow faster than any power of xx.
Practice 02Easy
Evaluate limx1lnxx1\lim_{x \to 1} \dfrac{\ln x}{x-1}.
Need a hint?
Confirm the indeterminate form, then differentiate top and bottom.
Show solution

1. Step 1: Confirm 0/0

At x=1x=1: ln111=00\frac{\ln 1}{1-1} = \frac{0}{0}.

2. Step 2: Apply L'Hôpital's Rule

limx11/x1=limx11x\lim_{x \to 1} \frac{1/x}{1} = \lim_{x \to 1} \frac{1}{x}.

3. Step 3: Evaluate

11=1\frac{1}{1} = 1.
Common Pitfalls
  • You MUST Confirm the Indeterminate Form FirstL'Hôpital's Rule only applies to 00\frac{0}{0} or \frac{\infty}{\infty} — using it on a limit that isn't actually indeterminate gives a wrong answer. Always check by direct substitution first.
  • Differentiate Top and Bottom SEPARATELYddx[f(x)g(x)]f(x)g(x)\frac{d}{dx}\left[\frac{f(x)}{g(x)}\right] \neq \frac{f'(x)}{g'(x)} — this is NOT the quotient rule. L'Hôpital's Rule differentiates the numerator and denominator independently as two separate functions.
  • Re-check After Every ApplicationAfter differentiating once, re-substitute to see if the new limit is still indeterminate. If so, apply L'Hôpital's Rule again — don't stop early.

Other Indeterminate Forms

Products, differences, and exponents can also be indeterminate — 0\infty \cdot 0, \infty - \infty, and forms like 000^0 or 11^\infty. None of these are ready for L'Hôpital's Rule as written; the trick is always the same: do algebra (or take a logarithm) FIRST to force the expression into a 00\frac{0}{0} or \frac{\infty}{\infty} shape.

Core Theorem
0\infty \cdot 0: rewrite one factor as a reciprocal in the denominator to create a fraction.
\infty - \infty: combine into a single fraction first.
Exponential forms (
00,0,10^0, \infty^0, 1^\infty): let yy equal the expression, take ln\ln of both sides to turn the exponent into a product, evaluate that limit, then exponentiate the result back (y=elimlnyy = e^{\lim \ln y}).

Worked Examples

Read these first — the full solution is shown, with the reasoning behind each move.

Worked Example 01Medium
Evaluate limx0+xlnx\lim_{x \to 0^+} x\ln x.
How to think about it

Key idea: This is 0()0 \cdot (-\infty) — rewrite xx as 11/x\frac{1}{1/x} to turn it into a fraction.

Full solution

1. Step 1: Rewrite as a Fraction

xlnx=lnx1/xx\ln x = \dfrac{\ln x}{1/x}, which is now \frac{-\infty}{\infty} as x0+x \to 0^+.

2. Step 2: Apply L'Hôpital's Rule

limx0+1/x1/x2=limx0+(x)\lim_{x \to 0^+} \dfrac{1/x}{-1/x^2} = \lim_{x \to 0^+} \left(-x\right).

3. Step 3: Evaluate

limx0+(x)=0\lim_{x \to 0^+}(-x) = 0.
Worked Example 02Hard
Evaluate limx0(1sinx1x)\lim_{x \to 0} \left(\dfrac{1}{\sin x} - \dfrac{1}{x}\right).
How to think about it

Key idea: This is \infty - \infty — combine into one fraction over a common denominator first.

Full solution

1. Step 1: Combine into a Single Fraction

1sinx1x=xsinxxsinx\dfrac{1}{\sin x} - \dfrac{1}{x} = \dfrac{x - \sin x}{x \sin x}, now 00\frac{0}{0}.

2. Step 2: Apply L'Hôpital's Rule

limx01cosxsinx+xcosx\lim_{x \to 0} \dfrac{1-\cos x}{\sin x + x\cos x} — still 00\frac{0}{0}.

3. Step 3: Apply Again

limx0sinxcosx+cosxxsinx=limx0sinx2cosxxsinx\lim_{x \to 0} \dfrac{\sin x}{\cos x+\cos x - x\sin x} = \lim_{x \to 0} \dfrac{\sin x}{2\cos x - x\sin x}.

4. Step 4: Evaluate

02(1)0=02=0\dfrac{0}{2(1)-0} = \dfrac{0}{2} = 0.
Step-by-Step SOP
  1. 1

    Identify the Indeterminate Form

    Determine whether it's 0\infty \cdot 0, \infty - \infty, or an exponential form (000^0, 0\infty^0, 11^\infty).
  2. 2

    Convert to a Single Fraction (or Take ln First)

    Products/differences: combine algebraically into 00\frac{0}{0} or \frac{\infty}{\infty}. Exponents: set yy equal to the expression and take ln\ln of both sides.
  3. 3

    Apply L'Hôpital's Rule, Then Exponentiate If Needed

    Solve the resulting fraction limit as usual. If you took a log, the final answer is ee raised to whatever you found.

Practice — Your Turn

Try each one before opening the hint or the solution.

Practice 01Hard
Evaluate limx0+xx\lim_{x \to 0^+} x^x.
Need a hint?
This is the 000^0 form. Let y=xxy=x^x, take ln\ln of both sides, and reuse the fact that limx0+xlnx=0\lim_{x \to 0^+} x\ln x = 0 from an earlier example.
Show solution

1. Step 1: Take the Natural Log

Let y=xxy=x^x. Then lny=xlnx\ln y = x \ln x.

2. Step 2: Evaluate the Limit of ln y

From before, limx0+xlnx=0\lim_{x \to 0^+} x\ln x = 0, so limx0+lny=0\lim_{x \to 0^+} \ln y = 0.

3. Step 3: Exponentiate Back

Since lny0\ln y \to 0, ye0=1y \to e^0 = 1. So limx0+xx=1\lim_{x \to 0^+} x^x = 1.
Practice 02AB/BC Standard
Evaluate limx0+(1+x)1/x\lim_{x \to 0^+} (1+x)^{1/x}.
Need a hint?
This is the 11^\infty form that famously defines the number ee. Take ln\ln of both sides first.
Show solution

1. Step 1: Take the Natural Log

Let y=(1+x)1/xy=(1+x)^{1/x}. Then lny=ln(1+x)x\ln y = \dfrac{\ln(1+x)}{x}, which is 00\frac{0}{0} as x0x \to 0.

2. Step 2: Apply L'Hôpital's Rule

limx01/(1+x)1=11+0=1\lim_{x \to 0} \dfrac{1/(1+x)}{1} = \dfrac{1}{1+0} = 1.

3. Step 3: Exponentiate Back

Since lny1\ln y \to 1, ye1=ey \to e^1 = e. So limx0+(1+x)1/x=e\lim_{x \to 0^+}(1+x)^{1/x} = e — this is exactly the limit definition of ee!
Common Pitfalls
  • Never Apply L'Hôpital's Rule Directly to a Product or Difference0\infty \cdot 0 and \infty - \infty are NOT ready-made fractions — you must rewrite them as a single fraction (via algebra) before differentiating top and bottom.
  • Exponential Forms Always Need a Logarithm FirstThere's no way to directly differentiate an indeterminate exponent like 000^0 — take ln\ln of the whole expression, evaluate THAT limit (usually reducing to 0\infty \cdot 0), then exponentiate your answer with e()e^{(\cdot)} at the very end.
  • Don't Forget to Exponentiate BackIf you found limlny=L\lim \ln y = L, the actual answer to the original limit is eLe^L, not LL itself — this last step is easy to forget under time pressure.

Optimization

Optimization problems ask for the best possible outcome — maximum area, minimum material, shortest distance — subject to some constraint. Every single one reduces to the exact same idea: turn a two-variable problem into a one-variable function, then find its absolute extremum.

Core Theorem
Steps for Optimization:
(1) Draw a diagram and label all quantities.
(2) Write the primary equation — the quantity you're optimizing — in terms of two variables.
(3) Write a constraint equation relating those variables, solve for one, and substitute into the primary equation so it depends on only one variable.
(4) Find the absolute extremum of that single-variable function (closed interval method, or First/Second Derivative Test).
Watch the TikTok ExplanationOptimization Problems

Worked Examples

Read these first — the full solution is shown, with the reasoning behind each move.

Worked Example 01Medium
A farmer has 1200 m of fencing to enclose a rectangular field along a river (no fence is needed on the side facing the river). Find the dimensions that maximize the enclosed area.
How to think about it

Key idea: Let xx be the width of the two perpendicular sides and yy the length parallel to the river. The constraint only counts 3 sides of fencing.

Full solution

1. Step 1: Write the Constraint and Primary Equation

Constraint: 2x+y=1200    y=12002x2x+y=1200 \implies y=1200-2x. Primary equation: A=xyA = xy.

2. Step 2: Reduce to One Variable

A(x)=x(12002x)=1200x2x2A(x) = x(1200-2x) = 1200x-2x^2, for 0<x<6000<x<600.

3. Step 3: Find the Critical Point

A(x)=12004x=0    x=300A'(x) = 1200-4x = 0 \implies x=300.

4. Step 4: Confirm the Maximum and State Dimensions

A(x)=4<0A''(x)=-4<0, confirming a maximum. y=1200600=600y=1200-600=600. Maximum area =300×600=180,000 m2=300 \times 600 = 180{,}000\ \text{m}^2.
Worked Example 02Medium
A 12×12 inch sheet of aluminum has a square of side xx cut from each corner, and the sides are folded up to form an open-top box. Find xx that maximizes the volume.
How to think about it

Key idea: The base becomes a (122x)(12-2x) by (122x)(12-2x) square, and the box height is xx.

Full solution

1. Step 1: Write the Volume Function

V(x)=x(122x)2V(x) = x(12-2x)^2, for 0<x<60<x<6.

2. Step 2: Differentiate and Factor

V(x)=(122x)24x(122x)=(122x)[(122x)4x]=(122x)(126x)V'(x) = (12-2x)^2 - 4x(12-2x) = (12-2x)\left[(12-2x)-4x\right] = (12-2x)(12-6x).

3. Step 3: Find Critical Points in the Domain

x=6x=6 is an endpoint (excluded), so the only interior critical point is x=2x=2.

4. Step 4: Confirm and Compute

V(0)=V(6)=0V(0)=V(6)=0, and V(2)=2(8)2=128 in3V(2) = 2(8)^2 = 128\ \text{in}^3 — the maximum volume, achieved by cutting 22-inch squares.
Step-by-Step SOP
  1. 1

    Draw a Diagram and Label Everything

    Identify all the quantities involved and give each one a variable name.
  2. 2

    Write the Primary and Constraint Equations

    Primary: the quantity to optimize, in terms of two variables. Constraint: a relationship between those variables, from the physical setup.
  3. 3

    Reduce to One Variable and Optimize

    Solve the constraint for one variable, substitute into the primary equation, then find its absolute extremum using the derivative tests you already know.

Practice — Your Turn

Try each one before opening the hint or the solution.

Practice 01Hard
A cylindrical can must hold exactly 1000 cm31000\ \text{cm}^3. Find the dimensions that minimize the amount of material (surface area) used.
Need a hint?
Solve the volume constraint for hh in terms of rr first, then substitute into the surface area formula so it depends only on rr.
Show solution

1. Step 1: Write the Constraint and Primary Equation

V=πr2h=1000    h=1000πr2V = \pi r^2 h = 1000 \implies h = \dfrac{1000}{\pi r^2}. Surface area: S=2πr2+2πrhS = 2\pi r^2 + 2\pi r h.

2. Step 2: Reduce to One Variable

S(r)=2πr2+2000rS(r) = 2\pi r^2 + \dfrac{2000}{r}.

3. Step 3: Differentiate and Solve

S(r)=4πr2000r2=0    r3=500π    r=(500π)1/35.42 cmS'(r) = 4\pi r - \dfrac{2000}{r^2} = 0 \implies r^3 = \dfrac{500}{\pi} \implies r = \left(\dfrac{500}{\pi}\right)^{1/3} \approx 5.42\ \text{cm}.

4. Step 4: Find h and Observe the Classic Result

h=1000πr2h = \dfrac{1000}{\pi r^2}. Substituting r3=500πr^3=\frac{500}{\pi} shows h=2rh=2r exactly — the optimal can always has height equal to its diameter.
Practice 02Hard
Find the point on the curve y2=2xy^2 = 2x closest to the point (1,4)(1,4).
Need a hint?
Minimize the squared distance D2=(x1)2+(y4)2D^2=(x-1)^2+(y-4)^2 after substituting x=y22x=\frac{y^2}{2} so it depends only on yy.
Show solution

1. Step 1: Write the Squared Distance in Terms of y

Since x=y22x=\frac{y^2}{2}: D2(y)=(y221)2+(y4)2D^2(y) = \left(\frac{y^2}{2}-1\right)^2 + (y-4)^2.

2. Step 2: Differentiate

d(D2)dy=y(y22)+2(y4)=y32y+2y8=y38\frac{d(D^2)}{dy} = y(y^2-2) + 2(y-4) = y^3-2y+2y-8 = y^3-8.

3. Step 3: Solve for the Critical Point

y38=0    y=2y^3-8=0 \implies y=2, so x=42=2x=\frac{4}{2}=2.

4. Step 4: Confirm and State the Answer

d2(D2)dy2=3y2>0\frac{d^2(D^2)}{dy^2}=3y^2>0 at y=2y=2, confirming a minimum. The closest point is (2,2)(2,2), at distance (21)2+(24)2=5\sqrt{(2-1)^2+(2-4)^2}=\sqrt{5}.
Practice 03Medium
A company's revenue and cost functions are R(x)=50x0.01x2R(x)=50x-0.01x^2 and C(x)=200+20x+0.005x2C(x)=200+20x+0.005x^2 (in dollars, for xx units). Find the production level that maximizes profit.
Need a hint?
Profit is P(x)=R(x)C(x)P(x)=R(x)-C(x) — maximize it like any other single-variable function. You should find that the maximum occurs exactly where marginal revenue equals marginal cost.
Show solution

1. Step 1: Write the Profit Function

P(x)=R(x)C(x)=(50x0.01x2)(200+20x+0.005x2)=30x0.015x2200P(x) = R(x)-C(x) = (50x-0.01x^2)-(200+20x+0.005x^2) = 30x-0.015x^2-200.

2. Step 2: Differentiate and Solve

P(x)=300.03x=0    x=1000P'(x) = 30-0.03x = 0 \implies x=1000.

3. Step 3: Confirm the Maximum

P(x)=0.03<0P''(x)=-0.03<0, confirming a maximum at x=1000x=1000 units — exactly the production level where R(x)=C(x)R'(x)=C'(x) (marginal revenue equals marginal cost).
Practice 04Hard
A store sells 200 units of a product per week at 350 dollars each. For every 10-dollar price decrease, weekly sales increase by 20 units. Find the price that maximizes revenue.
Need a hint?
Let xx be the number of 10-dollar price decrements. Write price and quantity both in terms of xx, then maximize their product.
Show solution

1. Step 1: Set Up Price and Quantity in Terms of x

Price =35010x=350-10x. Quantity =200+20x=200+20x.

2. Step 2: Write the Revenue Function

R(x)=(35010x)(200+20x)=70000+5000x200x2R(x) = (350-10x)(200+20x) = 70000+5000x-200x^2.

3. Step 3: Differentiate and Solve

R(x)=5000400x=0    x=12.5R'(x) = 5000-400x = 0 \implies x=12.5.

4. Step 4: Confirm and State the Answer

R(x)=400<0R''(x)=-400<0 confirms a maximum. New price =350125=225= 350-125 = 225 dollars, and maximum revenue =R(12.5)=101,250=R(12.5) = 101{,}250 dollars.
Common Pitfalls
  • Always Reduce to a Single Variable Before DifferentiatingThe primary equation almost always starts with two variables — don't differentiate until you've used the constraint to eliminate one of them.
  • Don't Skip Confirming Max vs. MinSolving f(x)=0f'(x)=0 only gives a candidate — use the Second Derivative Test (or check the domain's endpoints) to confirm it's actually the maximum or minimum you want, not the opposite.
  • State the Domain RestrictionsPhysical quantities like side lengths or radii must stay positive — always identify the valid domain (e.g. 0<x<60<x<6 for the box problem) before hunting for extrema, since it can rule out spurious critical points.
Gary Chang

Gary Chang

Calculus Educator

5+ Years of Calculus Teaching Experience | AP Calculus Specialist. Dedicated to helping students master calculus through step-by-step logic and clear visualizations.