# The most elegant solutions eliminate variables

It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience.      – Albert Einstein

When I first started learning programming (a very long time ago), I came across an exercise which seems simple enough. If you had three variables – say A, B and C – and you had to interchange the values of A and B, how would you do so? Well, the solution to this is simple – you use the variable C as a temporary store for one of the variables and then interchange the values like such:

1. C = A
2. A = B
3. B = C

Easy enough, right? Simple! But is that the most elegant solution to the problem? Let me frame the problem a little bit differently – what if we had to interchange the values of A and B – but without the luxury of having a third variable (C)? For the sake of argument, let’s just say each variable comes at a cost of \$1000 – so I am incentivized to make do with the least number of variables. Now it is a bit more interesting – challenging even. If we give this some thought, the solution we come up with would be:

1. A = A + B
2. B = A – B
3. A = A – B

Go ahead and try that out on a piece of paper with some values for A and B. It is elegant and it is frugal. It eliminates an unnecessary variable. And it works!

Why is this important – or relevant? In our lives and careers we often come across many challenges and problems that need solutions. Often times there are a lot of variables that are unknowns (or uncertain) – and these form the foundation of risk. Risk, if not mitigated, leads to issues – which if not resolved can lead to failed solutions.

The challenge then is to determine how one could approach the problem so that the chance of failure is minimized. Working backwards, one could postulate that, all other things being equal, failure could be minimized by minimizing the number of issues – which could themselves be minimized by mitigating risks appropriately. But the heart – the very root – of the matter is the risk itself – which can be reduced or eliminated by the elimination of as many variables as possible. This may not always be obvious – or easy, as our example illustrates – but we should expect nothing less of the work required to get to an elegant design.

Nothing is devoid of risk. And variables, unknowns and uncertainties will always exist – whether we like it or not. But by devising innovative solutions that eliminate variables, we come to the most elegant approach to solving the problem. And such solutions stand the test of time – because simplicity exudes beauty.

To paraphrase Einstein’s wisdom: Everything should be made as simple as possible, but not simpler.

So the next time you design solutions for a problem with many uncertainties, ask yourself what variables can you truly eliminate wile still solving the problem. I assure you the answer will be the most elegant, and the most satisfying.