What share of the money goes into each security so that the risk is smallest? For two securities there is a ready formula; for three you write down the Lagrange equations and solve them down to the share you need.
How the capital is split between securities decides income and risk. Optimal shares give the smallest risk for a required income or the largest income for an allowed risk. The exam asks you to find them or to set up their equations.
Anna invests 10 000 € again, now only in two stocks, with no deposit:
the first stock has return variance σ12=0.045;
the second σ22=0.015, the calmer one;
their covariance is σ12=0.0075.
What share of the money goes into the first stock for the smallest portfolio risk?
The first idea: all into the second stock, the less risky one. But the two do not move quite together, and a mix can be calmer than either, so the best share may lie in between.
The formula for two stocks is explained below. For Anna it gives the share of the first stock 0.045+0.015−2⋅0.00750.015−0.0075=61: about 1667 € in the first stock and 8333 € in the second. The variance of this portfolio is 0.01375, less than 0.015 for the second stock alone.
Check yourself. An exam-level task: two stocks have return variances σ12=0.06 and σ22=0.03, covariance σ12=0.01. What share of the capital in the first stock makes the portfolio variance smallest?
The basics: return and variance of a portfolio
The formulas come from “Portfolio: return and risk”; here on Anna's stocks: share a1=0.1 in the first, a2=0.9 in the second, expected returns μ1=0.105 and μ2=0.075.
Shares add up to 1: a0+a1+a2=1, where a0 is the safe security's share; with no deposit a0=0 and 0.1+0.9=1.
Expected return is the share-weighted sum of the returns: E(P)=a0⋅r+a1⋅μ1+a2⋅μ2=0.1⋅0.105+0.9⋅0.075=0.078.
Variance as for a combination in the article “Combinations aX + bY”: V(P)=a12⋅σ12+a22⋅σ22+2a1⋅a2⋅σ12=0.00045+0.01215+0.00135=0.01395. The safe security does not fluctuate and drops out.
The variance 0.01395 is below the 0.015 of the second stock alone: a little of the first lowers the risk. But how much?
With a safe security, substitute a0=1−a1−a2. Then E(P)=r+a1(μ1−r)+a2(μ2−r), where r is the safe rate. The differences μi−r are the excess returns (“Überrenditen”), what a stock brings on average above the safe security. They are needed in the Lagrange equations.
Two stocks: the minimum-variance portfolio
A little of the first stock lowered Anna's variance from 0.015 to 0.01395. How much of it to take so that the variance is smallest is what the first exam task asks outright:
Exam-style task
Die Renditen zweier Aktien haben die Standardabweichungen σ1=0.20 und σ2=0.30; ihre Kovarianz beträgt 0.012.
Welcher Anteil w1 des Vermögens ist in Aktie 1 zu investieren (der Rest in Aktie 2), damit die Varianz des Portfolios minimal wird? Geben Sie w1 auf vier Nachkommastellen gerundet an.
Multiply out: V(a)=a2⋅σ12+(1−a)2⋅σ22+2a⋅(1−a)⋅σ12=(σ12+σ22−2σ12)a2−2(σ22−σ12)a+σ22. Here a is the share of the first stock, so the constant term is σ22; in the article “Portfolio: return and risk” the variable was the share of the second stock, and the constant term was σ12.
The vertex of the parabola A⋅a2+B⋅a+C, where A is the number in front of a2, B the number in front of a and C the constant term, lies at a=−2AB, as in school. Here A=σ12+σ22−2σ12, B=−2(σ22−σ12), a=2(σ12+σ22−2σ12)2(σ22−σ12), and the twos cancel. The best share is a∗:
a∗==σ12+σ22−2σ12σ22−σ12
For Anna from the start: a∗=0.045+0.015−2⋅0.00750.015−0.0075=0.0450.0075≈0.167. About 16.7% goes into the first share, roughly 1 670 € of the 10 000 €, the rest into the second. The portfolio's variance is then 0.01375: less than the 0.015 of the second share alone, the first idea.
Step 1 of 4Switch to variances
The task gives standard deviations, the formula takes variances: σ12=0.22=0.04 and σ22=0.32=0.09. These are the ends of the parabola: all in the second stock gives 0.09, all in the first 0.04.
Numerator σ22−σ12=0.09−0.012=0.078.
Denominator 0.04+0.09−2⋅0.012=0.106.
a∗=0.1060.078≈0.7358, the vertex of the parabola; the task calls this share w1. Option (e).
The calmer first stock gets the larger part, and the smallest variance V(0.7358)=0.73582⋅0.04+0.26422⋅0.09+2⋅0.7358⋅0.2642⋅0.012≈0.02166+0.00628+0.00467≈0.0326 is below either stock alone.
Ask yourself: why does the numerator hold the second stock's variance when we want the first's share?
Two stocks: σ1=0.25, σ2=0.15, correlation coefficient ρ=0.4. Which share of the first gives the smallest variance?
a∗=0.0550.0075≈0.1364. The risky first stock gets little.
The second one, not the first. Two stocks have σ12=0.07, σ22=0.03, σ12=−0.01; find the share of the second stock.
For the second stock's share the numerator holds the variance of the first: σ12−σ12.
Work out the numerator, the denominator σ12+σ22−2σ12 and divide.
Your turn1 of 4
The returns of two stocks have standard deviations σ1=0.5 and σ2=0.3, and the covariance is 0.03. Which share of the first stock gives the smallest variance? Answer to four decimal places.
Traps. What each of the wrong options is made of:
Covariance forgotten, option (a), 0.6923: 0.04+0.090.09. That is the answer for independent stocks.
The 2 in the denominator lost, option (b), 0.6610: 0.1180.078; the denominator has 2σ12.
Standard deviations instead of variances, option (c), 0.6050: 0.5−0.0240.3−0.012.
Share of the other stock, option (d), 0.2642: 1−0.7358; the numerator holds the other security's variance.
Not on the sheet. Remember: a∗=σ12+σ22−2σ12σ22−σ12.
The Lagrange equations
With two stocks there is a single share, and the variance becomes a parabola whose vertex comes from the school formula. With three securities and a given return one share is not enough. Then the smallest variance is found with the Lagrange method:
Exam-style task
Eine Softwarefirma steckt ihr Budget in zwei Apps A und B und einen Wartungsvertrag mit fester Marge. Die Renditen von App A und App B haben die Erwartungswerte μ1=0.08 und μ2=0.135, die Varianzen σ12=0.04 und σ22=0.055 und die Kovarianz σ12=0.01. Das Portfolio besteht aus drei Positionen: a0 (Wartung, r=0.03), a1 (App A), a2 (App B), zusammen a0+a1+a2=1. Ziel ist eine möglichst kleine Varianz bei fester erwarteter Rendite 0.09. Als Lagrange-Funktion dient L=V(P)−λ(E(P)−E0) mit der festen Rendite E0.
Welches System für a1, a2 und λ entsteht, wenn man die partiellen Ableitungen dieser Lagrange-Funktion null setzt?
The giveaway is three securities and a goal with a condition: smallest variance at a given return E0 or largest return at a given variance V0. The task asks which system of equations is correct (“Welches Gleichungssystem”), not for its solution.
The method comes from the chapter on functions of two variables (“Lagrange method and implicit functions”). Here the smallest variance is the goal, the given return E0 (in the example below 0.09) the constraint (“Nebenbedingung”); without it the answer would be dull: variance 0, all in the safe security (in the task that is the maintenance contract). The Lagrange function adds a new unknown λ, the Lagrange multiplier:
L==V(P)−−λ(E(P)−−E0)
Its partial derivatives are set to zero: by a1, treating a2 and λ as numbers, then by a2 and λ (“Partial derivative: hold one variable fixed”). First substitute a0=1−a1−a2 and write E(P) with the excess returns.
Goal V(P), constraint E(P) = 0.09Excess returns 0.05 and 0.105Derivatives of V by a₁ and by a₂Right of “=” λ times the excess return
Step 1 of 4Separate goal and constraint
“The smallest possible variance at a fixed expected return of 0.09”: goal V(P), constraint E(P)=0.09. The task gives the Lagrange function: L=V(P)−λ(E(P)−E0).
Excess returns: 0.08−0.03=0.05 and 0.135−0.03=0.105. So E(P)=0.03+0.05a1+0.105a2.
V(P)=0.04a12+0.055a22+2⋅0.01a1⋅a2.
By a1: 2⋅0.04a1+2⋅0.01a2=2(0.04a1+0.01a2). By a2: 2(0.01a1+0.055a2).
The derivative of L by a1 is zero: 2(0.04a1+0.01a2)−0.05λ=0, so 0.05λ=2(0.04a1+0.01a2). Likewise for a2 with 0.105λ. The derivative by λ returns the constraint 0.09=0.03+0.05a1+0.105a2. Option (b).
Ask yourself: why is the right side 0.05λ and not 0.08λ?
Both kinds side by side:
Smallest variance at E(P)=E0
Largest return at V(P)=V0
Lagrange function
L=V(P)−λ(E(P)−E0)
L=E(P)−λ(V(P)−V0)
equation for a1
2σ12⋅a1+2σ12⋅a2=λ(μ1−r)
μ1−r=λ(2σ12⋅a1+2σ12⋅a2)
equation for a2
2σ12⋅a1+2σ22⋅a2=λ(μ2−r)
μ2−r=λ(2σ12⋅a1+2σ22⋅a2)
third equation
E(P)=E0
V(P)=V0
Dividing both derivative equations by 2 keeps the system correct: the unknown λ just halves. Dividing only one equation is wrong. If the goal is a standard deviation, V0=σP2: at σP=0.3, V0=0.09.
Statements about the method. Both versions are correct: the smallest variance at a given return and the largest return at a given variance. It is false that the method “maximises the return and minimises the variance” at the same time: the smallest variance, 0, belongs to the portfolio of the safe security alone, and its return is only r.
Back to Anna: r=0.025, μ1=0.105, μ2=0.075, σ12=0.045, σ22=0.015, σ12=0.0075. Wanted: the largest return at variance 0.02.
Derivatives of the goal: 0.08 and 0.05. Derivatives of the constraint: 0.09a1+0.015a2 and 0.015a1+0.03a2.
0.08=λ(0.09a1+0.015a2), 0.05=λ(0.015a1+0.03a2), 0.045a12+0.015a22+0.015a1⋅a2=0.02. Now λ sits with the derivatives of the variance.
Three equations for a1, a2 and λ. Take r=0.01, μ1=0.08, μ2=0.05, σ12=0.03, σ22=0.02, σ12=0.004; smallest variance at return 0.06. Write down the system.
Goal V(P), constraint E(P)=0.06.
Excess returns 0.08−0.01=0.07 and 0.05−0.01=0.04.
Differentiate V(P) by a1 and a2, put λ times the excess return on the right, and add the constraint.
Your turn2 of 4
A portfolio of a fixed-income security with r=0.05 and two stocks with μ1=0.16, μ2=0.13, σ12=0.025, σ22=0.035, σ12=−0.005 is to have the smallest variance at a given return. Which Lagrange equation for a1 is correct?
Traps. Three versions of the system that look like the right one:
λ on the wrong side, option (a): 0.05=2λ(0.04a1+0.01a2). That form is for the largest return at a given variance; here the variance is the goal.
Wrong constraint, option (c): third equation 0.09=V(P). The return is given, so it must be E(P)=0.09.
Rate not subtracted: option (d) takes 0.08λ and 0.135λ plus the wrong constraint; option (e) subtracts r nowhere and puts λ on the wrong side.
Not on the sheet. Remember: at the smallest variance the derivative of V by each share equals λ(μi−r), and the third equation is E(P)=E0.
Share for a given return
The exam tests the Lagrange system from the previous section a second time, now with a number as the answer:
Exam-style task
Gesucht ist das Portfolio (a0,a1,a2) mit der erwarteten Rendite 8.5% und minimaler Varianz. Eine Tierklinik teilt ihr Investitionsbudget zwischen zwei neuen Leistungen A (Physiotherapie) und B (Zahnbehandlung) und einem Vertrag mit einem Tierheim zu festen Sätzen.
Die Kovarianz der Renditen von Leistung A und Leistung B beträgt 0.005.
Wie groß ist der Anteil a1 von Leistung A?
a)0.1345
b)0.0846
c)0.0709
d)0.1066
e)0.1615
The giveaway is the same data as in “The Lagrange equations”, but the task asks for one of the shares, so the system is solved to the end. Conveniently, express λ from both derivative equations, set them equal, and put the link between a1 and a2 into the constraint.
Excess returns 0.08 and 0.125Divide by 0.08 and by 0.125Both λ equal: a₂ = 3.2269 a₁Into the constraint: a₁ = 0.1345
Step 1 of 4Write the system
Excess returns: 0.1−0.02=0.08 and 0.145−0.02=0.125; target minus rate 0.085−0.02=0.065.
The first equation by 0.08: λ=2a1+0.125a2; the second by 0.125: λ=0.08a1+0.72a2.
2a1+0.125a2=0.08a1+0.72a2, so 1.92a1=0.595a2 and a2≈3.2269a1.
0.08a1+0.125⋅3.2269a1=0.4834a1=0.065, so a1≈0.1345. Option (a).
Check: a2≈0.4339, a0≈0.4316, and 0.02+0.08⋅0.1345+0.125⋅0.4339≈0.085.
Ask yourself: why does the constraint's right side hold the target minus the rate, not the target itself?
The derivative equations do not contain the target, so the link between the shares does not depend on it: at another return E0 both shares change by the same factor, and the ratio a2:a1 stays. That gives a check: for portfolios with other targets the shares lie on the same ray, and a2:a1 stays 3.2269.
Anna wants a return of 0.07 at the smallest variance. Her numbers: r=0.025, μ1=0.105, μ2=0.075, σ12=0.045, σ22=0.015, σ12=0.0075.
λ=1.125a1+0.1875a2 and λ=0.3a1+0.6a2. Set them equal: 0.825a1=0.4125a2, so a2=2a1.
0.08a1+0.05⋅2a1=0.18a1=0.045, so a1=0.25, a2=0.5, a0=0.25.
One equation is left. Rate r=0.03, μ1=0.09, μ2=0.07, target 0.066; the link between the shares is already found.
a2=1.5a1.
Put the link into 0.03+0.06a1+0.04a2=0.066 and find a1.
Your turn3 of 4
For a portfolio with r=0.03, μ1=0.08, μ2=0.07 and target return E0=0.0528, the two derivative equations give a1=0.45λ and a2=0.15λ. What is a1?
Traps. In this task one mistake leads to the wrong option:
Rate not subtracted, option (e), 0.1615: 0.1, 0.145 and 0.085 instead of 0.08, 0.125 and 0.065, as if the safe part brought nothing.
The other share. If you got 0.4339, that is a2, but a1 was asked; if 0.4316, that is the remainder a0. Check which share is asked.
Not on the sheet. Remember: express λ from two equations, set them equal, and put the link into a1(μ1−r)+a2(μ2−r)=E0−r.
The share without Lagrange: one stock and a safe security, or two identical stocks
Solving the system in the previous section took several steps: express λ, equate, substitute. In the last task it is shorter, because there is only one risky security in it:
Exam-style task
Eine Versicherung hält einen Teil ihrer Reserven in einem Infrastrukturfonds, den Rest in sicheren Pfandbriefen. Die Rendite des Infrastrukturfonds hat die Varianz 0.0289; der sichere Teil (Pfandbriefe) bringt r=0.04. Das Ganze hat die erwartete Rendite E=0.0875 und die Standardabweichung σP=0.06. Welche erwartete Rendite μ hat der Infrastrukturfonds? Runden Sie auf vier Nachkommastellen.
a)0.1964
b)0.2544
c)0.2479
d)0.1346
e)0.1746
There are two cases where no Lagrange system is needed. In the first, the one of the task above, there is only one risky security, and the rest sits in a safe one at the rate r. The second case, two identical risky securities, comes further down. The first case needs five letters:
a the share of the risky security;
μ its expected return;
σ its standard deviation;
E the expected return of the whole holding;
σP the standard deviation of the whole holding.
The safe part does not swing, so V(P)=a2σ2, that is σP=aσ. One equation gives a, the other gives the answer:
σP==aσ,E==r++a(μ−−r)
The numbers of the task: an insurer holds part of its reserves in an infrastructure fund whose return has variance 0.0289 and the rest in covered bonds at r=0.04. The whole holding has E=0.0875 and σP=0.06; the fund's μ is asked.
The fund's variance is given, but σP=aσ needs the standard deviation: σ=0.0289=0.17.
The covered bonds do not swing, so all the risk comes from the fund: 0.17a=0.06, a=0.170.06≈0.352941.
E=r+a(μ−r): 0.0875=0.04+0.352941(μ−0.04), so μ−0.04=0.3529410.0475≈0.134583.
μ=0.04+0.134583≈0.1746. Option (e). Check: 0.04+0.352941⋅(0.174583−0.04)≈0.0875, as given.
Ask yourself: why is the fund's return larger than the return of the whole holding?
The second case without Lagrange: two risky securities with the sameμ and σ2 and zero covariance. The securities do not differ at all, and at the optimum the shares are equal: a1=a2=a, with the safe share a0=1−2a. Strictly, the Lagrange equations give this: at the largest return μ−r=λ⋅2σ2⋅a1 and μ−r=λ⋅2σ2⋅a2. The right sides are equal, so a1=a2. Then V(P)=2σ2a2, while putting everything into one security at the same return would give 4σ2a2, twice as much.
Two independent securities have the same μ=0.12 and σ2=0.08; a safe one pays r=0.03. The portfolio variance is to be 0.0144 at the largest return. What is a0?
V(P)=2⋅0.08a2=0.16a2=0.0144.
a2=0.09, a=0.3.
a0=1−2⋅0.3=0.4.
The portfolio variance is fixed. Both securities have σ2=0.045, covariance 0; the portfolio variance is to be 0.01. Find a and a0.
a1=a2=a, a0=1−2a.
V(P)=2⋅0.045⋅a2=0.09a2.
Set it equal to 0.01, take the root, find a0.
Your turn4 of 4
Two independent securities with the same μ=0.12 and σ2=0.05, and a fixed-income security with r=0.04. The portfolio variance is to be 0.016 at the largest return. What is the share a0?
Traps. These mistakes occur in this task:
r not subtracted, option (c), 0.2479: μ=aE=0.3529410.0875, as if the covered bonds earned nothing.
r not added back, option (d), 0.1346: this is μ−r, the excess return, not μ.
Variance instead of standard deviation: a=0.02890.06≈2.08. A share above 1 next to a safe security gives the error away at once.
Two identical securities, example 2 (σ2=0.08, V(P)=0.0144). If you got 0.4243, the 2 in 2σ2a2 was forgotten: 0.0144/0.08 instead of 0.0144/0.16. If you got 0.6, you gave the sum of the shares 2a instead of the remainder a0=0.4. If 0.09, the root is missing.
These special cases are not on the sheet. Remember: with one risky security σP=aσ and E=r+a(μ−r); for two identical independent securities V(P)=2σ2⋅a2.
At a glance: optimal portfolio weights
The topic in a minute
Two stocks, smallest risk:a∗=σ12+σ22−2σ12σ22−σ12.
Lagrange: at the smallest variance ∂ai∂V=λ(μi−r), third equation E(P)=E0.
Share for a given return: express λ from two equations, set them equal, and put the link into a1(μ1−r)+a2(μ2−r)=E0−r.
One risky security and a safe one:σP=aσ and E=r+a(μ−r).
Two identical independent securities:a1=a2=a and V(P)=2σ2⋅a2.
One risky security and a safe one, with the risk and return of the whole holding given; or two risky ones with the same μ and σ2, covariance 0, with the portfolio variance given.
σP==aσ,E==r++a(μ−−r);2σ2a2==V0
Trap:taking the variance instead of the standard deviation, not subtracting r or not adding it back; for two securities, forgetting the 2 or the root, or giving the sum of both shares.