
Session 05 - Single Variable Optimization
Mathematics for Master Students
Recap & Your Questions
Session 04 in a Nutshell
- The derivative \(f'(a)\) is the slope of the tangent, the instantaneous rate of change at \(a\)
- Power, sum, product, quotient and chain rule differentiate every gallery function
- \(e^x\) is its own derivative; \(\ln x\) has derivative \(\frac{1}{x}\)
- \(f''\) measures curvature: \(f'' > 0\) convex, \(f'' < 0\) concave, the chord intuition, formalized
- Marginal cost \(C'(q) \approx\) cost of one more unit; where \(R'(q) = C'(q)\) hides the best output
- Today: we turn a flat tangent into a recipe for finding the best decision
Common Issues in the Homework
- The inner derivative went missing: with \(V(t) = 200e^{0.1t}\), the chain rule gives \(V'(t) = 20e^{0.1t}\), the factor \(0.1\) is not optional, so the answer is not \(200e^{0.1t}\)
- Quotient order flipped: in \(\left(\frac{\ln x}{x^2}\right)'\) the numerator is \(f'g - fg'\), the minus acts on the second product; swapping the terms flips the sign
- A rate read as a total: \(C'(100) = 35\) means the 101st unit costs about €35, not that 100 units cost €35 (that total is \(C(100) = 7500\), i.e. €7500)
. . .
Which tasks gave you trouble? Bring them up now. We take the time to go through them before we move on to today’s topic.
Warm-Up: Find the Flat Spot
Differentiate \(f(x) = 2x^2 - 8x + 3\). At which \(x\) is the tangent horizontal?
. . .
- Differentiate term by term: \(\;f'(x) = 4x - 8\)
- Horizontal tangent means slope zero: \(\;4x - 8 = 0 \;\Rightarrow\; x = 2\)
- At \(x = 2\) the parabola turns, its lowest point, the vertex
- That flat spot is exactly where today’s hunt for optima begins
Today’s Plan
- Stationary points, a flat tangent flags a candidate: solve \(f'(x) = 0\)
- The second-order condition: does \(f''\) say peak or valley?
- Local vs global: closed intervals and business boundaries
- Optimization in business: profit maximization and the economic order quantity
Stationary Points & the First-Order Condition
What Does “Optimal” Mean?
Optimization means finding the input \(x\) that makes \(f(x)\) as large or as small as possible.
- Local maximum at \(x^*\): \(f(x^*) \geq f(x)\) for all nearby \(x\), a peak
- Local minimum at \(x^*\): \(f(x^*) \leq f(x)\) for all nearby \(x\), a valley
- Global (absolute) extremum: the largest or smallest value on the whole domain
- Business speaks this language daily: most profit, least cost, best order size
Where Can an Optimum Hide?
An extremum of a smooth function can only sit in one of three kinds of place:
- A stationary point, where \(f'(x) = 0\) (the tangent is flat)
- A boundary of the domain, the edge of what is allowed
- A kink, where \(f'\) does not exist (Session 4’s non-differentiable points)
. . .
For the smooth business functions in this tutorial, the first two cover almost everything, and stationary points come first.
The Flat-Tangent Idea
. . .
At a smooth peak or valley the graph momentarily stops rising or falling, the tangent is horizontal, so its slope \(f'(x)\) is zero.
The First-Order Condition
A point \(x^*\) with \(f'(x^*) = 0\) is called a stationary point (or critical point).
\[f'(x^*) = 0 \qquad \text{the first-order condition (FOC)}\]
- It is a necessary condition: every smooth interior extremum must be stationary
- So the FOC gives us the candidates, solve \(f'(x) = 0\) to find them all
- It is not sufficient: a flat tangent alone does not prove a peak or a valley
- Second step (next section) sorts the candidates into maxima, minima and neither
Finding the Candidates
Take \(f(x) = x^3 - 3x^2 - 9x + 5\). Where are its stationary points?
- Differentiate: \(f'(x) = 3x^2 - 6x - 9\)
- Factor: \(f'(x) = 3(x^2 - 2x - 3) = 3(x - 3)(x + 1)\)
- Set to zero: \(3(x - 3)(x + 1) = 0 \;\Rightarrow\; x = -1 \ \text{ or } \ x = 3\)
- Two candidates: \(x = -1\) and \(x = 3\), but which is a peak, which a valley?
. . .
Always factor \(f'(x)\) if you can, the stationary points are just its roots, and a factored form hands them to you directly.
Marginal Revenue Meets Marginal Cost
Session 4 promised: the best output is where marginal revenue meets marginal cost. Here is why.
Profit is revenue minus cost: \(\;\pi(q) = R(q) - C(q)\).
. . .
The first-order condition \(\pi'(q) = 0\) becomes:
\[\pi'(q) = R'(q) - C'(q) = 0 \quad \Longleftrightarrow \quad R'(q) = C'(q)\]
. . .
- In words: keep producing while the next unit earns more than it costs
- Stop where the extra revenue exactly equals the extra cost, \(R' = C'\)
- The abstract “\(f'(x) = 0\)” is the business rule “marginal revenue = marginal cost”
Your Turn: Is a Flat Tangent Enough?
A function satisfies \(f'(2) = 0\). Does that alone tell you \(x = 2\) is a maximum or a minimum?
. . .
- No, \(f'(2) = 0\) only makes \(x = 2\) a candidate
- The tangent is flat at peaks, at valleys, and at saddle points like \(f(x) = x^3\) at \(0\)
- The FOC narrows the search; deciding the type needs a second test, coming up next
Classifying Candidates: the Second-Order Condition
Peak or Valley? The Second Derivative Decides
At a stationary point \(x^*\), curvature settles the question, Session 4’s \(f''\) returns:
- \(f''(x^*) > 0\): graph is convex (bends upward), the valley of a bowl → local minimum
- \(f''(x^*) < 0\): graph is concave (bends downward), the top of a hill → local maximum
- \(f''(x^*) = 0\): the test is inconclusive, could be either, or neither
- The chord picture, made into a test: convex holds water, concave spills it
Classifying Our Candidates

- \(f''(x) = 6x - 6\). At \(x = -1\): \(f''(-1) = -12 < 0\) → local maximum, value \(f(-1) = 10\)
- At \(x = 3\): \(f''(3) = 12 > 0\) → local minimum, value \(f(3) = -22\)
- Where \(f'' = 0\), at \(x = 1\), the bend switches: an inflection point \((1, -6)\)
When the Test Is Silent: \(f'' = 0\)

. . .
For \(f(x) = x^3\): \(f'(0) = 0\) and \(f''(0) = 0\). The tangent is flat, yet the graph keeps rising, a saddle point, neither peak nor valley.
The FOC Is Never the Whole Story
Declaring “\(f'(x^*) = 0\), therefore it is a maximum”. A stationary point is only a candidate. Always check the second-order condition (or watch how \(f'\) changes sign across \(x^*\)) before naming it a max or a min.
. . .
- Alternative, the first-derivative test: if \(f'\) goes \(+ \to -\) at \(x^*\), it is a maximum; \(- \to +\), a minimum
- If \(f'\) keeps its sign across \(x^*\) (as for \(x^3\)), it is neither
- The first-derivative test always works, handy exactly when \(f'' = 0\) falls silent
Your Turn: Max or Min?
At a stationary point \(x^*\) of a cost function, you compute \(f''(x^*) = 8 > 0\). Is \(x^*\) a local maximum or a local minimum?
. . .
- \(f''(x^*) > 0\) means the graph is convex there, a valley
- So \(x^*\) is a local minimum, exactly what you want when minimizing cost
- Mnemonic: positive second derivative → holds water → minimum
Local vs Global & Boundaries
Local Is Not Global
A local optimum is best only in its neighborhood, a bigger peak may sit elsewhere.
- The cubic’s local min at \((3, -22)\) is a valley, but \(f\) dives far lower as \(x \to -\infty\)
- On an unbounded domain, a global optimum may not exist at all
- Extreme Value Theorem: a continuous function on a closed interval \([a, b]\) always attains both a global max and a global min
- Business is usually bounded (quantities live in \([0, \text{capacity}]\)) so globals exist
The Closed-Interval Recipe
To find the global max and min of \(f\) on \([a, b]\), compare a short list:
- Find every stationary point in \((a, b)\): solve \(f'(x) = 0\)
- Evaluate \(f\) at each of them
- Evaluate \(f\) at both endpoints, \(f(a)\) and \(f(b)\)
- The largest value is the global max; the smallest is the global min
. . .
Finding stationary points but forgetting the endpoints. The global optimum often sits at a boundary, skip it and you get the wrong answer.
A Boundary Can Win

Maximize \(g(x) = x^3 - 3x\) on \([0,3]\):
| \(x\) | \(0\) | \(1\) (stationary) | \(3\) (endpoint) |
|---|---|---|---|
| \(g(x)\) | \(0\) | \(-2\) | \(\mathbf{18}\) |
. . .
The only interior stationary point is a minimum; the global max \(18\) sits at the boundary \(x = 3\).
Business Domains Have Edges
Real decisions come with hard limits, and those edges are candidates:
- Quantities are non-negative: \(q \geq 0\), the edge \(q = 0\) may be optimal (produce nothing)
- Capacity caps output: \(q \leq 500\), the unconstrained optimum may lie past the limit
- When it does, the best feasible choice is the capacity boundary itself
- Model domain = mathematical domain \(\cap\) business constraints, an intersection, as in Session 2
Your Turn: The Capacity Limit
You maximize profit and the FOC gives \(q = 45\). But your plant can make at most \(40\) units, so \(q \in [0, 40]\) and profit is still rising at \(q = 40\). What is the best feasible output?
. . .
- The unconstrained optimum \(q = 45\) lies outside the feasible interval
- Profit increases all the way up to the edge, so the best feasible choice is the boundary \(q = 40\)
- Lesson: check the endpoints, a binding capacity limit is your optimum
Optimization in Business
Setting Up a Profit Problem
We reuse Session 4’s cost function and add a revenue function:
\[C(q) = 0.5q^2 + 10q + 200 \qquad R(q) = 100q - 0.5q^2\]
- \(C\): fixed costs \(200\), rising variable costs, marginal cost \(C'(q) = q + 10\)
- \(R\): revenue peaks then falls, since selling more needs a lower price, \(R'(q) = 100 - q\)
- Profit is the gap: \(\;\pi(q) = R(q) - C(q)\)
- The plan: build \(\pi\), apply the FOC, verify with the SOC
Worked Example: Build the Profit Function
Subtract cost from revenue, term by term:
\[\pi(q) = (100q - 0.5q^2) - (0.5q^2 + 10q + 200)\]
. . .
\[\pi(q) = -q^2 + 90q - 200\]
. . .
- A downward parabola, exactly the trade-off shape from Session 3
- Differentiate: \(\;\pi'(q) = -2q + 90\)
- The fixed cost \(200\) vanishes under differentiation, it shifts profit, not the optimum
Solve and Verify

- FOC: \(\pi'(q) = -2q + 90 = 0 \;\Rightarrow\; q = 45\), and \(R'(45) = 55 = C'(45)\), marginal revenue = marginal cost
- SOC: \(\pi''(q) = -2 < 0\) → concave → a maximum, confirmed
Reading the Optimum

. . .
The optimal quantity is \(q = 45\), and the maximum profit is \[\pi(45) = -45^2 + 90 \cdot 45 - 200 = -2025 + 4050 - 200 = 1825,\] that is €1825, the highest point of the profit curve.
Logistics: The Economic Order Quantity
A warehouse orders a product with steady annual demand. Order too often and ordering costs pile up; order too much and holding costs pile up. Balance them.
- Annual demand \(D\), fixed cost \(K\) per order, holding cost \(h\) per unit per year, order size \(q\)
- Ordering cost: \(\frac{D}{q} \cdot K\), \(\frac{D}{q}\) orders per year, each costing \(K\)
- Holding cost: \(\frac{q}{2} \cdot h\), average stock is \(\frac{q}{2}\) (fill to \(q\), draw down to \(0\))
- Total: \(\;T(q) = \dfrac{D}{q}\,K + \dfrac{q}{2}\,h\)
The EOQ: First-Order Condition

With \(D = 1000\), \(K = 80\), \(h = 4\), so \(T(q) = \dfrac{80000}{q} + 2q\):
- FOC: \(T'(q) = -\dfrac{80000}{q^2} + 2 = 0 \;\Rightarrow\; q^2 = 40000 \;\Rightarrow\; q^* = 200\)
The EOQ: Verify and Read
- SOC: \(T''(q) = \dfrac{160000}{q^3} > 0\) for all \(q > 0\) → convex → a minimum
- At \(q^* = 200\): ordering cost \(= 400\) and holding cost \(= 400\), equal, total €800
The Square-Root Formula
Solve the FOC in symbols and the classic EOQ formula drops out:
\[\frac{D K}{q^2} = \frac{h}{2} \;\Rightarrow\; q^2 = \frac{2 D K}{h} \;\Rightarrow\; \boxed{\,q^* = \sqrt{\dfrac{2 D K}{h}}\,}\]
. . .
- Check: \(\sqrt{\frac{2 \cdot 1000 \cdot 80}{4}} = \sqrt{40000} = 200\) ✓
- The optimum always balances the two costs, that is why they came out equal
- One tidy formula behind textbook inventory management, derived in four lines
Your Turn: Ordering Cost Doubles
A supplier doubles the fixed cost \(K\) per order. According to \(q^* = \sqrt{\frac{2DK}{h}}\), does the economic order quantity rise or fall, and by how much?
. . .
- \(q^*\) grows with \(K\) under the root, so a larger \(K\) makes \(q^*\) rise
- Doubling \(K\) multiplies \(q^*\) by \(\sqrt{2} \approx 1.41\), about a 41% larger order
- Intuition: if each order costs more, you order less often in bigger batches
Closing
Key Takeaways
- First-order condition: optima hide where \(f'(x) = 0\), solve it for the candidates
- Second-order condition: \(f''(x^*) > 0\) a minimum, \(f''(x^*) < 0\) a maximum, \(f'' = 0\) inconclusive, the FOC alone is never enough, since a flat tangent can be a saddle (\(x^3\) at \(0\))
- On a closed interval, compare stationary points and endpoints, boundaries can win
- Profit is maximal where marginal revenue = marginal cost, Session 4’s promise, delivered
- The EOQ \(q^* = \sqrt{2DK/h}\) balances ordering against holding costs
Skip order if running long: 1. Reading the Optimum plot (state \(\pi(45)=1825\) verbally on the previous slide), 2. The first-derivative-test bullets on the “FOC Is Never the Whole Story” slide, 3. Business Domains Have Edges (fold into the Your Turn capacity slide), 4. compress the R & C plot to a single sentence about the widest gap.
Until the Next Session
- Work through the Tasks: optimization drills with worked solutions
- Check yourself with the Self-Test quiz
- Keep the Cheatsheet next to you, the FOC/SOC recipe lives on it
- Note down anything unclear, we start next session with your questions
. . .
The recipe is always the same: differentiate, set \(f' = 0\), solve, then let \(f''\) decide. Name the goal (maximize or minimize) and the sign of \(f''\) you want follows.
Preview: Session 06 (Systems of Linear Equations)
- Central question: solve for several unknowns at once
- From one equation to a whole system, where do the lines meet?
- Elimination and substitution, done systematically
- Gaussian elimination for bigger systems, market equilibrium, production planning
. . .
See you there, and bring your questions!
Literature & Further Reading
- These sessions cover the essentials, textbooks offer more depth and practice
- Sydsaeter & Hammond: Essential Mathematics for Economic Analysis
- Jacques: Mathematics for Economics and Business
- Full recommendations on the tutorial’s literature page