When you are first hired to a new company, the human resource personnel would educate you that Employee Stock Purchase Plan (ESPP) is a fantastic deal etc. She would spend hours explaining how the 15% number would nest you a profit.

An ESPP typically works this way:

1. You contribute to the ESPP from x% of your salary. The contribution is taken out from your paycheck.

2. At the end of a “purchase period,” usually every 6 months, the employer will purchase company stock for you using your contributions during the purchase period. You get a 15% discount on the purchase price. The employer takes the price of the company stock at the beginning of the purchase period and the price at the end of the purchase period, whichever is lower, and THEN gives you a 15% discount from that price.

3. Some companies have 2 years lock period, she would have a little harder time to explain to you how that work. This is because with the x% salary and the 15%, this gets a little more complicated. Eventually you will understand the concept, but you will forget it right away because in your mind you don’t have a very concise picture of this whole business.

Today, I am going to show you a concise math formula to help those engineers to understand it, if you still can’t remember it after reading it, you should quit your engineering job :

Let date2 be the start of the ESPP cycle, date1 be the end of the cycle. date1-date2=6 months. We use daten denote the nth 6 months prior to date1.

your_current_price=0.85*min(previous_locked_price,price(date1),price(date2))

and then set the previous_locked_price for the next period:

previous_locked_price=min(your_current_price,

previous_locked_price(date2),

previous_locked_price(date3),

previous_locked_price(date4),

previous_locked_price(date5))