My last article provided an overview of Warren Buffett and the evolution of his investment philosophy. But what specifically led Warren Buffett to invest in such diverse companies as Coke (NYSE:KO), The Washington Post (NYSE:WPO), Gillette (NYSE:G), General Dynamics (NYSE:GD), Freddie Mac (NYSE:FRE), and others?

Today, we begin to answer that question by deriving the method Buffett uses to analyze the quantitative worth of a company: the Discounted Cash Flow equation.

Disclaimer
Before we go any further, you should know that this article is all about math. If you are the type of person who simply turns to the back of the book for answers, then the following may not be for you. But if you're the type of person who just has to know the ins and outs of the equations you rely on to value companies (or if you just love math), then read on.

Derivation of the DCF
Let's get started with a definition:

The Discounted Cash Flow model determines the present value of a company by estimating its future cash flows, discounting those cash flows to present value, and summing these discounted values.

Well, that seems pretty straightforward! Fortunately, we can make this much more complicated by looking at the details. Let's take the definition one part at a time.

Estimating future cash flows
Let's say Company X has a current cash flow of \$100 per year, and its cash flows are growing at 10% for each of the next five years. All we have to do to estimate the future cash flows is multiply each yearly value by (1 + growth rate), or 1.10:

Year 1 2 3 4 5
Cash Flow* (prior year) \$100 \$110 \$121 \$133 \$146
x Growth factor 1.10 1.10 1.10 1.10 1.10
Cash flow* \$110 \$121 \$133 \$146 \$161
*Cash values are rounded to the nearest dollar.

Mathematically, given a growth factor (g), the future value (FV) in year n can be calculated from the present value (PV) with the equation:

FV = PV x (1 + g)n (Equation 1)

For year four in the above table, this gives us:

100 x (1 + 0.10)4 = \$146

Present value in the DCF model
For a clear description on the concept of present value, please check out James Early's recent article. We'll skip ahead and simply present the present value equation:

PV = FV x [1/(1 + r)n] (Equation 2)

Notice that this equation is the inverse of Equation 1. The only difference is that we now use r (expected rate of return) rather than g (growth). This is an important distinction.

The expected rate of return refers to the risk-free return we could expect to get on our money (if we invested in a certificate of deposit, for example).

We use the expected rate of return (or expected return) to calculate the present value of any future amount. For example, say our friend Barney offered to pay us \$150 in five years if we gave him \$100 today. And let's say our local bank is offering a five-year certificate of deposit paying 5% interest. We can then calculate the present value of that \$150:

PV = \$150 x [1 / (1 + 0.05)5]
= \$150 x [1 / 1.055]
= \$150 x (0.784)
= \$117

That \$150 is actually worth \$117 to us today. Assuming we know Barney will pay us back (which we do because he is the most trustworthy talking elephant we know), then loaning him the \$100 is a good deal.

The discount factor
The discount factor (DF) is simply the term we use to refer to [1/(1 + r)n]. In the Barney example, our discount factor equals 0.784. By using the concept of a discount factor, Equation 2 simplifies to:

PV = FV x DF (isn't that pretty?)

Don't forget where the discount factor comes from, because we will rely heavily on it later on (in this article and the next).

Discounting future cash flows
Let's run through an example.

Assume Company X is growing cash flow at 10% per year and our (risk-free) expected return is 5% (as above). To find the discounted cash flow from year n (DCFn), we multiply the expected cash flow in year n (CFn ) by our discount factor for year n (DFn):

DCF(n) = CFn x DFn (Equation 3)

The simplest way to complete this for a series of years is in a spreadsheet:

Year (n) 1 2 3 4 5
Cash flow (CFn) \$110 \$121 \$133 \$146 \$161
x discount factor (DFn) 0.952 0.9070 0.864 0.823 0.784
Discounted cash flow (DCFn) \$105 \$110 \$115 \$120 \$126
*Cash values are rounded to the nearest dollar.

Summing discounted values
The discounted cash flow valuation is simply a sum of the discounted values:

DCFtotal = \$105 + \$110 + \$115 + \$120 + \$126 = \$576.

Assuming Company X produces no more cash flow after five years (perhaps they go out of business), we would say that Company X is worth \$576 today. We can determine whether Company X is fully valued by comparing this calculated value to Company X's actual market value.

The whole shebang: The DCF equation
As we saw above, DCFtotal is the summation of the individually discounted values, so we can say:

DCFtotal = DCF(1) + DCF(2) + DCF(3) + . + DCF(n)

Where n represents the last year of the company's existence (i.e. 50 years from now).

By flushing out Equation 3, we get a specific equation for each DCF(n).

DCF(n) = CFn x DFn
= CF0 x (1 + g)n x [1 / (1 + r)n]
= CF0 x [(1 + g) / (1 + r)]n

And in summation (chuckle), we can write:

DCFtotal = CF0 x SUM[(1 + g) / (1 + r)]x for x = 0 to n (Equation 4)

And that is our Discounted Cash Flow equation!

NOTE: Under specific conditions we can simplify this equation to calculate values far into the future. We take a look at the assumptions this requires in my next article.

Strengths of the DCF model
The DCF model is very flexible. By employing different growth and discount factors, we can easily model companies going through lifecycle transitions (from high growth to average growth, for example). Since the model accounts for expected growth, we can use it as a universal comparison metric: A high-growth company can be compared to a low growth company (or any other company) by analyzing how its calculated value compares with its actual value. This comparison also allows us to estimate an expected return on our investment and can help us limit risk by investing in more established companies with more consistent operating histories (we'll look at this more in a future article).

Weaknesses of the DCF model
The further into the future we look, the more uncertain our estimates. The chief weakness of the DCF model is its sensitivity to these estimates. Small changes in assumptions can lead to large changes in calculated value. To temper this effect, we should always be conservative in our assumptions. This "glass half empty" approach will increase the likelihood that we will be pleasantly surprised rather than sorely disappointed.

For more on the benefits and pitfalls of the DCF model, read David Meier's illuminating column, "Using DCF Foolishly."

What's next?
As a Foolish investor, you must certainly be wondering about the actual values we use in the DCF equation: What cash flow numbers? Where do we find growth values? What is my risk free expected rate of return?

Deriving the DCF equation and answering all of those questions in the same article would just be too much fun. Have heart. My next article covers all of those questions (with much less math).

For more:

Our Motley Fool Inside Value newsletter has an online DCF calculator that subscribers can use to their hearts' content. Check it out by taking a free, no-obligation trial right now.

Fool contributor Jim Schoettler hasn't showered since he began working on this series of articles several months ago. So if anyone would like some vine-ripened tomatoes that recently sprouted from his left ear, please email him \$5 for postage and handling. Jim does not own any of the stocks discussed in this article.