The goal of any smart investor should be to get the best possible deal when purchasing stock. The better the deal, the higher the potential for profit. In this regard, both a company's P/E ratio and stock price can offer great insight into whether the time is right to buy a given stock.

Stock price
Stock price is simply the amount of money it will cost to purchase a share of a company or fund. Stock prices can fluctuate based on a number of factors. If a company releases a glowing earnings report, then investors will likely feel more optimistic about its potential profitability. Demand for the stock will climb, and so will its price. On the other hand, if a company reports negative earnings or is the subject of bad press, its stock price can quickly fall.

P/E ratio
The P/E ratio measures the relationship between a company's stock price and its earnings per share of stock issued. The P/E ratio is calculated by dividing a company's current stock price by its earnings per share (EPS). If you don't know the EPS, you can calculate it by subtracting a company's preferred dividends paid from its net income, and then dividing the result by the number of shares outstanding.

Let's say a company has net income of $1 billion, it pays $200 million in preferred dividends, and it has 400 million shares outstanding. Here's how we'd calculate its EPS:

($1 billion - $200 million) / 400 million shares = $2 per share

Now that we know the EPS, we can figure out the P/E ratio. If the stock currently trades for $30 per share, then the P/E ratio would simply be $30 divided by $2, or 15.

Stock price and P/E ratio
While a company's stock price reflects the value that investors are currently placing on that investment, a stock's P/E ratio indicates how much investors are willing to pay for every dollar of earnings. The market price of a given stock is needed to calculate its P/E ratio, but in many ways, the P/E ratio offers better insight into the stock's growth potential.

Generally speaking, a high P/E ratio indicates that investors expect higher earnings. However, a stock with a high P/E ratio is not necessarily a better investment than one with a lower P/E ratio, as a high P/E ratio can indicate that the stock is being overvalued. If you invest in an overvalued stock, you run the risk of losing money if it doesn't meet investors' high earnings expectations.

On the flip side, when a company's stock has a low P/E ratio, it may indicate that the stock is undervalued. Investors can often buy undervalued stock at a discount and then profit when the price of that stock climbs. That said, sometimes a low P/E ratio reflects a genuine lack of growth potential.

You can compare a company's P/E ratio with that of similar companies in its industry to get a sense of whether the stock you're looking to purchase is overvalued or undervalued.

This article is part of The Motley Fool's Knowledge Center, which was created based on the collected wisdom of a fantastic community of investors. We'd love to hear your questions, thoughts, and opinions on the Knowledge Center in general or this page in particular. Your input will help us help the world invest, better! Email us at [email protected]. Thanks -- and Fool on!

Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.