Curious math equality derived by a developer

Roman Kushnirenko
3 min readDec 2, 2020

I’m a software developer, and sometimes I’m given tasks that provide me with some curious results that, as for me, should be shared with others. I don’t know if these results can be useful in practice, but I think that their beauty makes them worth spreading. And this post is about one of such findings.

Initially, I was given a random sample X₁, …, Xₙ from the unknown distribution. For some reason, I needed to build another sample Y₁, …, Yₙ with Yᵢ = |Xᵢ|. And the task was to determine if some relationship between sample means (X̄, Ȳ) and sample variances (σₓ)², (σᵧ)² of these samples exists.

I believe it would not be redundant to recall the definitions of these statistics:

And now, let’s back to our problem. Firstly, it can be noticed that Xᵢ ≤|Xᵢ| = Yᵢ so

This inequality can be made stronger:

So we’ve proved that

And what about inequality for sample variances? Does it exist, or sample variances relate to each other arbitrarily? A little spoiler: it exists. Moreover, sample means and sample variances satisfy beautiful equality that inspired me to write this post.

To begin with, we need to derive another expression for sample variance (this derivation is for math geeks only and can be skipped without loss of comprehension):

So we have

or

We can obtain the same equality for Yᵢ:

And the last step. Since

we can obtain that

As for me, this result is worth attention. We’ve obtained some kind of invariant. Although this result cannot be compared to invariant intervals in special relativity, I hope it could be in some way useful. Maybe you, my readers, know some applications of this equality. If so, please share them in the comments.

It’s all for now. See you later when some puzzle inspires me to write a new post:)

--

--