How Can You Model Data With A System of Equations?

In December of 2014, Sony released the movie The Interview online after threats to theaters cancelled the debut in theaters. As originally reported in Wall Street Journal, the sales figures reported in January contained an interesting math problem appropriate for algebra students.

The following January, Sony reported sales of $31 million from the sales and rentals of The Interview. They sold the movies online for $15 and rented through various sites for $6. If there were 4.3 million transactions, how many of the transaction were sales of the movie and how many of the transactions were rentals?

Continue reading “How Can You Model Data With A System of Equations?”

How Do You Model a Stock Portfolio Containing Two Stocks?

To model a simple stock portfolio with two stocks, we’ll write down a system of two equations in two variables. We hope to find a unique solution to this system, so let’s make sure we understand two key ideas.

  • We need two variables.
  • We need two equations.

Why are these important?

Two Variables?

The variables represent the two unknown quantities we are looking for. Since we want to know how much two invest in each stock in a tow stock portfolio, the two variables will represent the amounts of money invested in each stock. If we had more stocks in the portfolio, we would need more variables to correspond to.

Two Equations?

If we hope to solve our system of linear equations for a unique solution, the number of equations must match the number of variables. This assumes that one of these equations is not redundant. For this model, we’ll get our equations from two pieces of information, the total amount invested in the portfolio and the total return desired.

For a larger portfolio, we would need more equations to specify a unique solution. In that case we would need more information such as an average beta for the portfolio.

Write Out the System

For this portfolio, we will model two securities:

Based on data from the end of January 2016, we know the following information.

Security  Annual Dividend Yield  Beta
Tootsie 1.16% 0.7
Diebold 4.45% 1.51


Our goal for this example is to invest a total of $50,000 with a total dividend return of 3%. This is attainable since one security in the portfolio has a higher yield and the other a lower yield. It would be impossible to combine the stocks in a portfolio to get a total yield higher that the highest yielding stock of lower than the lowest yielding stock.

Start with your variables. I’ll call mine x1 and x2 and describe them as

x1: amount invested in Tootsie

x2: amount invested in Diebold

Once you understand what these are, it is easy to use the information in the problem to write out the two equations.

Total Amount Invested Is $50,000

We can start to get mathematical by writing

Total Amount Invested = 50,000

To finish the equation, we need to write the left side of the equation in terms of the variables. A “total” indicates addition so write

x1 + x2 = 50,000

Total Dividend Return is 3%

If the total dividend return needs to be 3% of $50,000, we need a total of

3% of $50,000 = (0.03)(50,000) = 1500

This total dividend will come from the dividend on the Tootsie stock,

1.16% of the amount invested x1 = 0.0116 x1

and the dividend on the Diebold stock,

4.45% of the amount invested x2 = 0.0445 x2

So if the total dividend from the portfolio is $1500 and this is the sum of the dividend from each stock in the portfolio,

0.0116 x1 + 0.0445 x2 = 1500

Model for a Two Stock Portfolio

Combining the two equations together gives a system of two linear equations in two variable,

x1 + x2 = 50,000

0.0116 x1 + 0.0445 x2 = 1500

We can solve these graphically or algebraically. If we use the substitution method and solve them graphically, solve for x1 in the first equation to give

x1 = 50,000 – x2

Putting this into the second equation leads to

0.0116 (50,000 – x2)+ 0.0445 x2 = 1500

        580 – .0116 x2 + 0.0445 x2 = 1500

                                 0.0329 x2 = 920

                                                       x2 ≈ 27,963.53

If $27,963.53 is invested in Diebold, then x1 ≈ 50,000 – 27,963.53 or $22,036.47 must be invested in Tootsie.

The sum of these amounts is $50,000 as desired and the total dividend is

0.0116(22036.47) + 0.0445(27963.53) ≈ 1500

as it should be.

How Do You Solve a Linear System with WolframAlpha?

Many of you may already be familiar with using a graphing calculator to put a matrix in reduced row echelon form. Did you know that you can do the same thing with WolframAlpha?

To see how this is done, let’s start from the system of linear equations


Convert this system into a 3 x 4 augmented matrix:


WolframAlpha understands several commands for putting an augmented matrix into reduced row echelon form. You can use the command rref { }or the command row reduce { }. The matrix goes inside the curly brackets. However, the matrix must be put in carefully. Each row needs to be typed in inside of curly brackets with the entries separated by a commas. In this case, you would type


on the command line in WolframAlpha.

After you press Enter, the reduced row echelon form is computed,


This indicates that the solution to the system is

x = 65,000, y = 45,000, z = 40,000.

How Does Elimination Compare to Matrix Elimination?

You probably noticed that the process we used to solve linear systems in Section 2.2 is almost identical to the process we used to solve linear systems in Section 2.4.

To make this concrete, let’s compare the steps for the system

In the table below, the steps for solving the system using elimination are shown on the left side in blue. The steps for matrix elimination are shown on the right in green. You can click on the table to make it larger.

Click to enlarge table
Click to enlarge table

Notice that each step for elimination corresponds to an almost identical step in matrix elimination. The main difference is the absence of the variable in matrix elimination.