We need your help to stop the war in Ukraine. Support Ukraine

I Thought I Would Never Use Math Again

Google BigQuery scripting

It was yet another online meeting where we discussed design patterns with my colleagues. Somewhere during the conversation I used the knowledge about disjunctive normal form in boolean logic as an argument to throw away some unnecessary UX elements. This saved us tens of hours on design validation and development. At the end of the meeting one guy told me that he thought he would never use math again after he graduated from the university.

Honestly, in the beginning of my career I thought the same way. Don’t get me wrong, people use some pieces of math here and there every day. When you come to the grocery store to buy four big tasty apples and there are only three left, the equation 3<4 becomes quite obvious for you.

But what about multidimensional integrals, differential equations or even modulo operation? It was really fun to learn all of that while getting a masters degree but what about real life applications? The unfilled gap existed between applied and theoretical math inside my head. But I naturally filled this gap by solving problems using math.

Let’s try to derive some formula from the SaaS world where I’m currently in. There are a lot of different interconnected SaaS metrics. One of the easiest looking relations for the monthly subscription model is:

LT = 1/C

LT is the lifetime of a customer or the number of consecutive months that the customer stays with you. C is a monthly churn rate. It tells you what fraction of your current client base you lose every month. C is usually less than 1 because you don’t want your business to collapse by losing all the customers. Let’s try to find out the math behind this equation.

A side note for math and SaaS geeks here. I’ll use some level of simplification here so as not to overload the text with a lot of possible nuances of LT and C calculations. I’ll stay as simple as possible.

When you subtract C from 1, you get retention rate R or the fraction of customers that stay with you. R is also less than 1. If some person purchased a monthly subscription then you have a customer for at least one month. There is no uncertainty in the first month of subscription.

For each next month you can’t be sure that the customer will stay, so you have to use R as a measure of uncertainty. In other words, from month to month you are less sure that the customer will stay. Also each next month only exists in a life cycle if the previous month exists. So you can model LT like this:

LT = 1 month + 1 month * R + 1 month * R * R + 1 month * R * R * R + …

Or simply

LT = 1 + R + R^2 + R^3 + … + R^(n-1)

where n is the number of months that you want to account for and ^ is a power sign.

You don’t know the exact moment when you lose the customer so you want to account for all the months in the life cycle. But this way the sum becomes endless. So are we done here? How can we calculate the sum of something endless? Stay calm and get some math to the rescue. Use a simple yet beautiful trick from a schools math class and multiply both sides of the equation by R:

LT * R = R + R^2 + R^3 + R^4 + … + R^n

Now subtract later from former:

LT - LT * R = (1 + R + R^2 + R^3 + … + R^(n-1)) - (R + R^2 + R^3 + R^4 + … + R^n)

Open the brackets and rearrange the terms to see what you’ll get here:

LT - LT * R = 1 + (R - R) + (R^2 - R^2) + (R^3 - R^3) + … + (R^(n-1) - R^(n-1)) - R^n

When you open the brackets all the powers of R on the right side of the equation cancel each other except 1 and R^n. So the equation becomes:

LT(1 - R) = 1 - R^n

Or finally:

LT = (1 - R^n)/(1 - R)

As you remember R is less than 1 and if you multiply it a lot of times by itself the product will get closer and closer to 0. Take R=0.5 as an example and grow n to see what is happening:

0.5^2 = 0.25

0.5^5 = 0.03125

0.5^10 = 0.0009765625

0.5^20 = 0.000000953674316 - quite close to 0, isn’t it?

So if n goes all the way up to infinity (and that is what we actually want to achieve here) our equation becomes this:

LT = 1/(1 - R)

As you remember, 1 - R is C so you can rewrite the equation like:

LT = 1/C

Did you notice that you used probability theory, commutative and associative properties of binary operations and limits theory while playing with this equation? If you missed that, you really did.

Now if you know that SaaS has a monthly churn rate of 0.1, you can quickly calculate the lifetime of the customers for that company and it will be 10 month. Multiply it by average order value and you’ll get lifetime value - another famous SaaS metric.

I’m pretty sure that math is one of key knowledge that people should study and use. Also I’m pretty sure that the main obstacles in learning math or any other discipline are the lack of interest and real life application. I wish you to reopen the math for yourself and use it as a handy tool. There is no “I don’t get math” but there is “I don’t get enough value for me to understand math”.

By the way, did you know that there is a model that explains how diseases like COVID are spread and why you should wash your hands and practice social distancing? Check this video by Tom Crawford where he explains the SIR model.

Read this blog on Medium


comments powered by Disqus