# Algebra and geometry

In software engineering the Model-view-controller design pattern is widely used and most people have some understanding of what the general principle is. Basically, you have your logic and data that you encapsulate within a model and then a controller picks the right views to display the model and handle user inputs.

The separation of code into three independent parts provides a clear understanding of what the essence of the application is - the model. All the other parts (the controllers and the views) only offer different ways of accessing the model.

# Mathematics #

What about mathematics? Its so easy to get lost in such a vast field while searching for models. Think of the time you moved to a new city. Navigating yourself at first is very difficult and you often get lost. Once you become familiar with landmarks and main streets you begin to confidently plan your routes. After some time, you get so accustomed to the city, that you know multiple ways of reaching your destination.

Mathematics has multiple ways for you to reach any part of it. Going back to the first analogy - there is always some inherent model which is represented by one or more views. Let me give you an example.

# The square of the sum of two numbers #

Here’s a tiny bit of arithmetic, say you want to square the sum of two and three.

`(2+3)^2 = 25`

## Algebra #

A more abstract and algebraic expression would look like this.

`(a+b)^2 = a^2 + 2ab + b^2`

This expression is something we learn by heart while we’re at school. It is one of many rules we learn. But it is not immediately apparent why this rule is correct, for instance, why besides having two square we also have `2ab`

in the expression? Algebraically you could explain this by expanding the square into multiplication of two identical factors.

`(a+b)^2 = (a+b)(a+b) = a^2 + ab + ba + b^2`

Because multiplication of scalars is a commutative operation, we can rearrange the expression into what we’re looking for.

`a^2 + (ab + ba) + b^2 = a^2 + (ab + ab) + b^2 = a^2 + (2ab) + b^2`

## Geometry #

All those manipulations of symbols are completely abstract, but thanks to the inherent model of multiplication we can apply a new __view__ to this one rule and see it in a different, less abstract light.

Geometrically it is easy to imagine how the __square__ of some **a** looks like. **A** becomes the length of a side of a square and the area of the square is the result of multiplying **a** by itself.

If you have two components, you get two squares. But they don’t fully cover the area, and what’s missing are the two products.

When you combine the two, you get a filled square, and the sum of the two squares and the rectangles is the area.

# Extracting the models #

This is just one example of finding two different views for a mathematical rule (model). Seeing them together makes it easier to abstract the model mentally and see what are the underlying mechanics.

If you have other examples, I’d love to see them - wilde.morgan@gmail.com

Thanks!