We all invest for the same reason: to make money. And to make money in investing, we need to know two key things: when to buy and when to sell.

If you can buy something for $1 and turn around and sell it for $2, then you've made money. If, on the other hand, you buy something for a buck and can't find someone willing to take it off your hands for more than $0.50, you've lost money. Clearly, to make money at investing, the goal is to buy low and sell high. More than half a century ago, Benjamin Graham, the pioneer of value investing, came up with a simple way to do just that -- a concept known as the "margin of safety." By employing this technique, investors greatly decrease the chance that they'll lose their hats and increase the likelihood that they'll trounce other investors.

Following in Graham's footsteps, Bill Miller, who runs Legg Mason Value Trust (FUND:LMVTX), beat the market for 15 consecutive years -- a record practically unheard-of in the mutual fund industry. And Miller's long-run performance pales in comparison with that of Warren Buffett, a former pupil of Graham's.

Know a company's true worth
The key to success is a clear understanding of a company's true worth. With that knowledge in hand, buying low and selling high becomes a simple matter of waiting, buying a stock only when it falls below the company's true worth by a tempting margin. Once you own it, you need to keep tracking the company's value. When the stock rises to an uncomfortably high premium to its true worth, sell it. The central lesson: All buying and selling decisions should be guided by comparing a company's stock price to its true worth, not by some vague notion of what the hot stock of the moment is.

My friend and colleague Philip Durell follows that philosophy as the chief analyst at Motley Fool Inside Value. His selections as a whole are handily beating the market's return since the newsletter's inception in 2004. His record is added proof that using a margin of safety truly does work.

Philip has beaten the market without help from the likes of Internet search titan Google (NASDAQ:GOOG) and its outrageous return since its initial public offering in 2004. Instead, Philip has relied on stalwarts such as Lloyds TSB (NYSE:LYG), a leading British bank with a nearly 6% yield. Philip recommended Lloyds when it traded for $31.79, but he figured it was worth more. Sure, Lloyds hasn't rocketed skyward like Google has, but it has beaten the market by approximately 28 percentage points since being picked.

Buying low with the margin of safety
Every company has what Graham calls an "intrinsic value," a measure of what that company is really worth. Finding that value is part art and part analysis. One of the most powerful tools in a value investor's toolkit is a discounted cash flow calculator, into which you put your estimate of how much cash the company will generate in the ensuing years. The calculator then tells you how much the company is worth today. Inside Value has just such a calculator available to subscribers. If you're already a subscriber, you can access it here. If not, you can get access by taking a free 30-day trial of the newsletter.

Once you've figured out what the company is worth, you can use that information to determine whether it has enough of Graham's margin of safety to be worth buying. For example, in August 2004, I told Inside Value subscribers on a members-only message board that homebuilder Lennar (NYSE:LEN) (NYSE:LEN-B) looked undervalued. Its class A shares traded at the time at $42.77. That same stock recently traded at $43.70 and has handed its owners about $1.51 in dividends per share in the interim.

That may not seem like a tremendous return, but it does show the protective power you get when you buy a stock that is objectively cheap. After all, right now, we're in the midst of a panic sale of homebuilder stocks during a cooling housing market. Lennar itself even recently warned that its earnings for this year would likely fall below expectations. Even so, investors who bought when the stock looked cheap in 2004 have still made money! It's a great illustration of how you can join other value investors at putting into practice Warren Buffett's famous Rule No. 1: "Never Lose Money."

Selling high with the margin of safety
Logically, if a company trading below its intrinsic value is worth buying, then a company trading at or above its intrinsic value just might be a candidate for selling. For instance, back in March of last year, I calculated that telecom equipment provider Lucent Technologies appeared to be overpriced. Consolidation among its wireless customers diminished the need for so much overlapping equipment. At the same time, its wireline services seemed to be shifting to digital solutions that rivals provided.

In all, there looked to be little chance for further recovery. Without continued improvement, I no longer wanted to hold my shares. Using what is known as a covered call strategy, I offered to let someone else buy my shares for a total of $3.10 each. Thanks to the surprise announcement that Alcatel would be merging with Lucent to form Alcatel-Lucent (NYSE:ALU), Lucent's shares briefly jumped high enough to make it worth it for that someone to take me up on my offer. As a result, I cashed in $3.10 each for its shares. For comparison, more than a year later, the merged company changed hands for what would have been $2.46 per pre-converted Lucent share. That's a more than 20% tumble.

Follow the formula
Once you've figured out what a company is really worth, its margin of safety will tell you when it's time to buy and when it's time to sell. The lower a company's price with respect to that intrinsic value, the stronger the margin of safety, and the better the chance that buying that company will lead to a profitable investment. The higher a company's price with respect to intrinsic value, the more that margin of safety has been reversed, and the better the chance that it's time to sell your position and take the extra profits from your bargain-hunting trip.

Like the idea of knowing how to buy low and sell high? Want more value investing tips and techniques? Start with a free 30-day trial of Inside Value, The Motley Fool's home of the margin of safety.

This article was originally published July 13, 2005. It has been updated.

At the time of publication, Fool contributor and Inside Value team member Chuck Saletta owned class B shares of Lennar as well as a small number of shares of Alcatel Lucent that remain in his account after his options were called away. The Fool has a disclosure policy.