gl/ripetizioni

Functions of two variables and constrained maxima in Year 5

Partial derivatives, the Hessian and Lagrange multipliers applied to choice problems: Year 5 maths on the AFM and SIA tracks, step by step.

by Gaetano Livornese

Read the original in Italian

On the AFM and SIA tracks (the Italian technical-economic institutes: Amministrazione, finanza e marketing and Sistemi informativi aziendali) Year 5 almost always restarts with a quick review of derivatives, and after two or three weeks you go straight into functions of two variables — the chapter that is almost never seen at the science high school, and for that reason there is very little material online calibrated on this specific syllabus. The test on constrained maxima generally falls between the start and the end of November, so six to ten weeks from now, and in December the first mock second paper (the second written paper of the maturità, Italy’s school-leaving exam) already arrives. Whoever puts off understanding the Hessian and Lagrange until the week before finds it very hard, because they are two tools that have to be made automatic with practice, not understood on the fly the night before.

From a function of one variable to a surface

Up to Year 4 you worked with : one variable in, one out, the graph is a curve on the plane. With two input variables the notation becomes , and the graph is no longer a curve but a surface in space: for every pair in the domain, the function returns a height .

You don’t need to visualise the surface to work well with these problems — indeed, for the economic problems you’ll see later it is better not to think of the drawing, because and represent quantities (of product, of hours, of budget) and not spatial coordinates. What you really need is to know how to differentiate, and here the novelty is small but has to be understood well straight away.

Partial derivatives: you differentiate one variable, the other stands still

The partial derivative with respect to , written or , is calculated by differentiating normally with respect to and treating as if it were a fixed number, a constant. In the same way, is calculated by differentiating with respect to treating as a constant.

An example to fix the mechanics. Let

For , I treat as a constant: becomes (the differentiation rule for multiplied by the constant ), is a constant so its derivative with respect to is , and becomes :

For , I treat as a constant: becomes (because has exponent 1), becomes , and is now the constant, so its derivative with respect to is :

All the rules you already know (power, product, chain) hold unchanged, applied to one variable at a time. If the basic differentiation rules are not yet automatic, it is better to go back and review them before tackling this chapter — you’ll find them explained well in this post on derivatives: here I don’t re-explain them, because the new difficulty is not the derivative, it is handling two variables together.

Free maxima and minima: stationary points and the Hessian

A point is stationary when both partial derivatives vanish at the same time:

By solving this system (usually two equations in two unknowns) you find the candidate points for being a maximum, a minimum, or neither. To classify them you need the Hessian, which sums up in a single number the behaviour of the second derivatives at the point:

where is the derivative of taken again with respect to , is the derivative of taken again with respect to , and is the “cross” derivative (differentiate with respect to , or with respect to : the result is the same). The sign rule:

  • and → the point is a minimum;
  • and → the point is a maximum;
  • → the point is a saddle point (neither maximum nor minimum: the surface rises on one side and falls on the other, like a horse saddle);
  • → the test says nothing, a different analysis is needed (rarely asked in Year 5 at technical institutes).

Constrained maxima and minima: two roads to the same result

In most problems you are not looking for the absolute maximum of the function, but the maximum while respecting a condition: a fixed budget, a total quantity of hours, a production constraint. This is the case of constrained maxima, and AFM teachers ask for it to be solved with two different methods.

The substitution method

When the constraint is a linear equation — the most common form, for example — you can express one variable in terms of the other and substitute it into . The result is a function of a single variable, which you already know how to study: derivatives, stationary point, done. It is the method the teacher asks for most often, because it is the one you have most experience with, and it is always worth trying first when the constraint lends itself.

Lagrange multipliers

When the constraint is not convenient to isolate, or when the exercise explicitly asks for the method, you build the Lagrangian function: if the constraint is , you write

and solve the system of the three partial derivatives of set equal to zero:

The third equation, , always returns the original constraint — it is the way the Lagrangian “forces” the solution to respect it. The value of found is not a calculation error to be thrown out: it is called the multiplier, and in economics it has a precise meaning (by how much the maximum would change if the constraint were loosened by one unit), but for the test it is enough to know how to calculate it and use it to check the system.

The point to fix well: substitution and Lagrange, applied to the same problem, must give exactly the same result. If you find two different answers, one of the two calculations has a mistake — a small discrepancy “due to approximation” is not normal.

Why in business economics: economic functions

All this is not an exercise in calculus for its own sake: it is the tool AFM uses to deal with economic functions. A company that produces two different goods has a profit that depends on both quantities produced; resources — labour, raw materials, budget — are limited, and this limit is exactly the constraint of constrained maxima. Finding the combination of quantities that maximises profit while respecting the constraint is, in essence, the first building block of operations research and of the choice problems that will come later in the year: same logic, with progressively more elaborate functions.

The mistake I see most often

The first mistake is in the Hessian formula: many write or get confused about the square of . The formula has a product, not a sum, and the cross term must be squared: . A wrong sign here turns a maximum into a saddle point in the marking.

The second, on the substitution method: you differentiate with respect to and before substituting the constraint, and then try to “adjust” the result at the end. It doesn’t work: you must first express one variable from the constraint, substitute it into , obtain a function of a single variable, and only then differentiate. The order of operations is not interchangeable.

First worked exercise: a free maximum with the Hessian

Let’s study the function

Stationary points. I calculate the first partial derivatives:

I set both equal to zero:

The only stationary point is .

Classification with the Hessian. I calculate the second derivatives:

and : the point is a maximum.

Maximum value. I substitute , into the starting function:

The maximum of the function is , reached at .

Before the second exercise, a useful check: if the derivatives of functions of one variable don’t come naturally to you, practise with the Year 5 maths practice test on derivatives. It is not calibrated on functions of two variables — that specific quiz doesn’t exist yet — but the differentiation rules it asks for are identical to those you have just used: whoever gets a partial derivative wrong almost always gets it wrong because of the basic derivative, not because they haven’t understood the concept of two variables. The correct answer is free, the guided solution unlocks with your first lesson.

Second worked exercise: the same choice problem with substitution and with Lagrange

A company produces two goods, in quantities and . The profit (in thousands of euros) is given by

and the total availability of labour imposes the constraint

We want the combination that maximises profit while respecting the constraint.

Method 1 — substitution. From the constraint I get and substitute into :

I work out the calculations. . Then , so :

I differentiate and set equal to zero:

So , and the maximum profit is

Method 2 — Lagrange. With the constraint , the Lagrangian is

The three partial derivatives:

From the first two equations, I isolate in both and compare them: and , so

I substitute into the constraint :

and so — exactly the same solution found by substitution. The maximum profit, calculated with the starting formula:

Same result from the two methods: thousand euros, with units of the first good and of the second. This is the check to always make when the exercise asks you for both methods: if the numbers don’t match, go back and check, don’t carry on.

To practise

First review the differentiation rules with the Year 5 maths practice test on derivatives, then go back to these two exercises and try redoing them without looking at the workings. The Year 5 formula sheet also covers the rest of the calculus syllabus you need from here to May.

For the other chapters of the year on AFM you’ll find double-entry bookkeeping explained — a Year 3 post, but it is the foundation on which the business economics of the last three years is built — and if you study at a vocational school, Year 5 on that track tackles an essential function study calibrated on a syllabus different from yours.

For all the rest of the Year 5 maths syllabus there is the maths page. If you want a hand on this chapter or on a specific choice problem, the first chat is free → contact.

Keep reading

Want to put what you read into practice?

Let's talk for 30 minutes, free: we look together at where you are stuck and I tell you honestly how I can help.

Or message me on WhatsApp.