## Day 34: Example of the Laplace pdf

Last post, we finally got to use the exponential pdf and discovered the math wasn’t completely useless (okay, hopefully by now you know that). However, in the spirit of finding a use for the equations we are covering, let’s look at how we use the laplace pdf. It’s going to be a blast, so let’s get started!

By now, if you’ve been keeping up you know that I like to do a bit of review before we get started. First, if this is new to you, you may want to start at the beginning (always a good place to start really), you can find that post here! Okay, if you’re all caught up, let’s do a quick review of what the Laplace pdf looks like:

This should look very similar to our example yesterday and there is good reason for this, look at the plot of the pdf and you’ll see it’s pretty close to the shape of the exponential pdf. In fact it’s half the size and mirrored about the mean, but we can see that in the equation, we take 1/2 of the λ value and take the absolute of the term in the exponential, which is why we can now deal with negative values (where as before with the exponential it was only valid if x ≥ 0. This is why it is often referred to as the double exponential distribution (because it’s two exponentials mirrored. Remember that for both cases, the exponential pdf and laplace pdf, the λ > 0, so that doesn’t change.

Okay, so let’s talk about some real world applications for the Laplace pdf. Before we begin, we should probably point out that there are a few, but not many. The that’s the problem with it being so similar to the exponential pdf, really it’s just a special case. Well, let’s look at when you may want to use the laplace pdf.

There are few cases where laplace is used and frankly I was having trouble with finding a good example from those few use cases. So instead of creating, then solving a problem, we will just talk about a few uses since that might illustrate the use beter. The first example would be its use in differential privacy.

Differential privacy is a way to guarantee bounds on how much information is revealed by someone’s participation in a database. See, not a very clear example. However, differential privacy has very specific mathematical roots and is a strong form of privacy protection. It adds noise to protect your privacy and gets applied to queries, not the database itself. For example, the more intrusive a query, the more noise must be added. Essentially what this means is that the algorithm keeps a person from finding out that the information they got was from YOU specifically.

Say you give our example database system an input, say you want to know the mean height of a group of people from age range 20-21. The algorithm would give you the information you want, but it would add noise to the way it was computed so you could not determine where the values came from, the more specific the question, the more noise is added to the formulation. Note this doesn’t change the output, it will still be the mean height from the age range you want, it just adds enough noise to make sure that you can’t tell where the information came from without affecting the output.

This system was developed by cryptographers and you can see why it would be useful in cases where there are large databases *side eyes google* you can also see why you would want to keep this information safe and this method does a very good job of that.

Fear not, there are other uses that may seem more practical and less abstract (although data privacy is definitely not an abstract or impractical idea everyone, come on now). We can also use the laplace distribution to model extreme events! Events like the maximum one-day rainfall during a storm, or the amount of water a river will discharge. This was probably one of the first uses for the laplace distribution. Remember this was discovered (I’m debating if that is the right way of phrasing that), by famous smart french guy Laplace himself back in the late 1700’s so way before anything resembling a computer (or database for that matter) existed.

In any case, this is why I thought it best to go over how it’s used instead of diving into solving a problem, this one is a touch on the abstract side. Fear not! Next post we can dive into the normal distribution and that one is used in a lot of applications so it should be a good time all around.

Until next time, don’t stop learning!

*My dear readers, please remember that I make no claim to the accuracy of this information; some of it *might* be wrong. I’m learning, which is why I’m writing these posts and if you’re reading this then I am assuming you are trying to learn too. My plea to you is this, if you see something that is not correct, or if you want to expand on something, do it. Let’s learn together!!

## But enough about us, what about you?