# Find two unknowns that have a certain ratio.

I need to find a value for L and S where:

• P = 20
• L = 2S + P
• L + S + 3P = 1160

It's for deciding the column width in a website layout, which can change according the available screen size:

I tried giving L a random value that sounded about right (700) and then solving S using the first equation, but then the second simply turned out false, so that didn't work.

(Sorry if this question is too "amateuristic" for this site, but it doesn't look like there's a better SE alternative)

-
Do you know anything about matrices, Gaussian elimination, or linear algebra? –  anon Jul 30 '11 at 14:11
@anon: Little. My math level is (high school) - (things I've forgotten) + (basic matrices and vectors used in game programming) –  Bart van Heukelom Jul 30 '11 at 14:14
If you don't, the quickest fix would be to substitute $L=2S+20$ into the second equation to get $3S+80=1160$, which solves as $S=360$, and plugging $S$ into the first equation gives $L=740$. However if you know anything about the concepts I linked above there are more general approaches that work and that you might want to know about. –  anon Jul 30 '11 at 14:15

What you have is a system of linear equations. Several methods for solving these are described in this section of that article.

In the present case, the most direct solution would be to substitute $L$ from the first equation into the second one:

$$(2S + 20) + S + 60 = 1160$$

$$3S + 80 = 1160$$

$$3S=1080$$

$$S=360\;.$$

Then plugging that into the first equation yields

$$L=2S + 20 = 2\cdot360+20= 720 + 20=740\;.$$

-
I'm familiar with substitution and tried it, but the result was rather unhelpful (2S - 2S = 0). I probably did it wrong or with the wrong equations. Thanks –  Bart van Heukelom Jul 30 '11 at 14:18