# Math behind Matrix: do we live in a simulation?

## Abstract

Many people are fascinated by science through books, comics, TV series and science fiction films. Among these little gems of fantasy and curiosity, we find a title that has shaken the hearts of many: the film ‘The Matrix’ and its trilogy.

The Matrix is a film that deliberately questions everything around us, leading the viewer to question – and take on what Descartes called ‘Hyperbolic Doubt’ – the relationship we have with others and the world in general, right down to the relationship we have with ourselves.

In this article, we will go to the basis of The Matrix, describing not only the world that is depicted – real and virtual – but also the fundamental, mathematical concept that underpins the entire film series.

## Overview

The masterpiece written and directed by Sisters Wachowski

It is a cult, a masterpiece, so profound and solid that it is still discussed and elaborated upon today by old and new fans alike.

The opening is so simple that it strikes the viewer in-depth and captures him within the first few minutes of the film with a simple question: what if everything around us was not real?

The plot recounts the vicissitudes of Thomas Anderson, a hacker with the pseudonym ‘Neo’, whose actions attract the attention of the infamous Agents of the Matrix, who are ready to intervene and quell any anomalies that arise in the ‘perfect’ virtual world.

Neo gets too close to ‘reality’ and ends up discovering that his life up to that point is fiction, a virtual projection of a world that no longer exists. Nevertheless, he embraces the truth and becomes ‘aware’ of the stark reality of which the Matrix is only a part.

## Themes

Awakening, Destiny, Search of identity. Who are we, and why are we here

The first theme is definitely ‘awakening’, an awareness that makes us aware of what is real and what is not. We can superimpose this theme on the study of nature through science, the discernment between what is real and true from what is not.

Another topic addressed is destiny, understood as a designated and desired role. We talk about the role we create -and that we want to play- which can strongly conflict with the role we have been designated -thus imposed.

The search for identity is the most articulated theme. The classic hero’s journey is taken to extremes and enhanced to the extreme, and the moral choices in the ongoing search for the answer to the question “who are we?” are extremely strong. The change we observe in the protagonist and the characters is clear and defined.

The theme that drives the narrative is Humanity vs. Machines -a detailed version of the generic Man vs. Environment-. From the outset, the conflict that spawned the Matrix is clearly described and defined, along with the role that mankind plays alongside the machines in the plot. The worldbuilding is solid and studied.

The article shows how a virtual space that can be visited and interacted with originates from the concept of the Mathematical Matrix.

## Are we living in a simulation?

Answers that are difficult to accept: our minds are used to seeking meanings and purposes

Entering into a topic that, although it might have a solid scientific basis, is a purely philosophical one, the answer is indeed very peculiar. We could, as it were, live in a simulation. Unfortunately, however, there is no way to answer such a question.

Meanwhile, we could be fooled by the word ‘simulation’. From the earliest times, we wondered about it, but instead of simulation, we used the word ‘dream’.

Today, we consider the idea because we have achieved truly impressive computing power, and we, therefore, wonder if someone has beaten us to it. From a scientific point of view, there is no way to prove this. From a philosophical point of view, we can do some more reasoning, such as using the ‘Occam’s Razor’ technique.

Can the simplest answer help us?

Who knows.

When one ponders the question of the universe’s origin (which science has been able to describe since a certain point in time), one comes to the question of the cause of birth, the cause that started everything. This also embraces the question of consciousness, of which we have first-hand experience (Descartes again said, Cogito ergo sum: I think, therefore I am).

We can say that these two problems are extremely interlinked and have a very strong limitation in our understanding and interpretation, but that they are topics that cannot, at present, be addressed by science. Science is about description and observation.

Science can help narrow the field, but the contribution is only marginalising the problem.

Science cannot give answers that humans seek from an intimate point of view: why are we in the world? Science cannot provide a meaningful answer on this ground. Science can answer with survival and reproduction. Answers that are difficult to accept: our minds are used to seeking meaning and purpose in everything we do and live.

Nevertheless, the question of the plausibility of a simulation of reality has been analysed by various thinkers-scientists and philosophers.

Already in antiquity, many asked the same question, starting with the philosopher Chuang zi or Descartes. Not only them, but also others thought that our experiences were subjective, therefore fallible and possibly linked to some illusory mechanism, as in the film The Matrix.

Nick Bostrom dealt with this question in a rather interesting way “Are you Living in a Computer Simulation?”. Here’s the link.

According to Bostrom, there are three possibilities, and only one can be true:

- No civilisation will ever be able to reach the necessary technological level
- If they do, they decide not to
- We are in a simulation created by someone else.

According to Bostrom, if we can create a simulation, then we will definitely be ourselves in a simulation.

Many scientists have studied this, trying to debate the plausibility of the question with other scientists and philosophers.

As we have already said, the problem cannot be investigated from a scientific point of view. Only philosophy can deal with it.

We have no concrete reason to think that the hypothesis of being or not being part of a simulation is correct or not. A few scientists, however, have tried to come up with some ideas, such as by analysing breaks and anomalies in natural laws.

This hypothesis is not falsifiable. We cannot prove that it is false or true, so it is not possible in any way to treat, confirm or disprove it.

But what if we had more information on the concept of consciousness?

In that case, again, science could contribute by marginalising certain issues, and nothing else. Could an experiment in a simulation really give useful data? Could mathematics and logical reasoning lead us to absurdity?

These are fascinating questions, no doubt about it, but if it were true that we live in a simulation, then would we have finally justified our existence? Or what we think, desire, and want is planned?

How might this fit in with the non-deterministic nature of reality? To date, it is unthinkable to support or not support simulation theory. Still, we can inform ourselves on some related topics such as the nature of consciousness, the inability to generate random numbers and the loop problem. In fact, even assuming we live in a simulation, we would still be unable to answer the fundamental question of life, the universe and everything else.

## Mathematics and the Matrix

Matrix comes from Latin and its meaning is ‘Pregnant animal’ or ‘Womb’

The film ‘The Matrix’ has a large lap structure and humans connected to energy converters. They are mentally connected to the Matrix software and live in virtual reality. A simulation.

We discuss together possible connections between the film and Mathematics, investigating some interesting and fascinating deeper meanings.

## The future and Markov chains

Could we read the future if we are good at Statistics?

Mathematically, matrices are rows and columns of numbers. They can be added to each other and sometimes multiplied. You may not think you have ever had to deal with a matrix, but you have not: a computer monitor, for example, is actually operated by a matrix.

The trilogy uses the matrix to address the ‘free will and predestination’ debate. A mind, human or otherwise, living in the reality of the Matrix can come to understand the future, the algorithm of the oracle.

The future is like a set of events with their own probability of occurrence, the realisation of a specific event being the consequence of a finite (but also possibly numerous) number of choices. It is a matter of calculating probability and predicting the most probable events.

But it goes even further. If one thinks of an event as defining the current ‘state’ of the future, the possibility of moving to a different state can vary depending on one’s initial state. In statistics, we study an object called a ‘Markov chain’, a process often introduced as a drunkard’s step. In other words, a Markov chain is a system in which the state of the system uniquely determines the probability of a state i at time k at time k – 1 and not by its history. The drunkard, like the process, has no memory, and his next step will depend only on the one he has just taken. Markov chains, therefore, describe a particular stochastic process suitable for modelling systems that have random behaviour in their evolution; they describe random phenomena that evolve as a function of time and have no memory of previous states.

Let’s put it more poetically:*a process is Markov if,** knowing (exactly) the present,** past and future are independent.*

Markov chains are fascinating because they relate Matrices and Probability Theory to computational operations.

Thus, a matrix in a Markov process helps us to identify the probability of certain future events, although it does not tell us with certainty which chain of states we will pass through or which state we will be in after a certain time t.

In The Matrix, this is shown in the last scenes of The Matrix Reloaded, in a dialogue between Neo and the Architect, the algorithm that strives for the system to be as stationary as possible. The TV screens show the protagonist’s possible choices, but as he decides, they synchronise.

Synchronisation represents the ‘ever-increasing probability’ that Neo will do just that particular action.

## Matrices and Linear Algebra

An introduction of Matrices, Linear algebra and Equation systems

**Matrices**

Matrices are mathematical objects that have a wide application in the most diverse fields of science. They may have different meanings and applications, but the matrix theory remains the same.

From an abstract and purely mathematical point of view, matrices are useful tools for finding solutions and operations between them.

In the most general sense, a matrix is a set of elements with a dual alignment. They have m rows and n columns. Matrix A(m,n) is a matrix of dimension mxn.

When m and n are equal, the matrix is said to be square.

This is a 4×4 matrix because it has 4 rows and 4 columns.

This is a generic nxm matrix:

Each matrix element has an index ij, ranging from 1 to the generic element n or m. What does this mean? The index i indicates the row, while j indicates the column. a23 indicates the element in the second row and third column.

**A little example of Linear Equations**

In linear algebra, matrices are connected to the solution of linear systems. One of the main problems in mathematics has always been determining the solutions of an equation: are there values that, when substituted for the unknown, make the equality true?

Let’s take a simple case:

2x = 4.

What is that value substituting for the variable x and multiplied by two gives us 4? The value is 2. In fact, 2*2=4.

This is a simple case of an equation, called a linear equation of the first degree, to one unknown. A one-row matrix (2 4) where the first row represents x and the second the known term. Dividing the matrix by two, we obtain (1 2) i.e. x=2. Simple, isn’t it?

When we have several linear equations, and we have to find consistent solutions to all the equations, then we are studying systems of linear equations.

A convenient way to solve a linear system is using the ‘Matrix’.

A linear equation in two unknowns represents a line in the Cartesian plane.

Let us take an example in two unknowns, x, and y.

Putting two linear equations in two unknowns into a system means asking what the solution for which the lines intersect, i.e. have a point in common, is.

The matrix representing this system is

The first column of the matrix is the x-field, the second the y-field, and the third the known term. Subtracting row one from row two we obtain (0 -4 1). This is a very easy way to solve systems of linear equations, don’t you think?

As we can see, in this hypothesis, we have three possible cases:

No solution: the lines are parallel

Only one solution: the lines are incident

Infinite solutions, overlapping lines

In our case, we have a solution: the point is y= 1/4

In Linear Algebra, Matrices are used to compactly write and work with multiple linear equations (a system of linear equations); they are very useful for finding solutions, doing linear transformations, and more.

We might study and discuss linear algebra in a more suitable place. They are very useful and fascinating.

## Conclusions

Algorithms and Linear algebra:Neo is a non solvable polynomial equation

The choices of many elements of the Matrix are defined by Markov chains (simplicity assumption). We have an algorithm/transformation matrix that wants to reset the state of the Matrix to restore order (and not only that).

The inhabitants of the Matrix are solvable polynomial equations, whereas Neo is a non-solvable and, therefore, independent equation.

Agent Smith can copy himself into the minds of the inhabitants of the matrix, acting as a matrix operator capable of manipulating the internal elements so as to make all values equal to himself (and according to what the oracle says, the probability of him being able to clone himself into the entire matrix after a certain time is 100%).

Finally, many other aspects of the simulated world are handled by Linear Algebra Matrices. The film’s title is not necessarily directly related to linear algebra. Still, looking at the sprinkling of code in the opening titles or the trailer, it is obviously related to computer matrices, which are very similar to mathematical matrices.

It is clear that the film has many facets and deals with deep and compelling themes. Without the title ‘The Matrix’, it would probably not have had the same effect of astonishment, fascination and curiosity.

### Bibliography

Buchanan, Mark. Nexus: Small Worlds and the Groundbreaking Science of Networks. New York: Norton, 2002.

Watts, Duncan J. Small Worlds: The Dynamics of Networks between Order and Randomness. Princeton: Princeton University Press, 1999.

Kris H. Green – What’s in a Name? The Matrix as an Introduction to Mathematics

Amedeo Balbi – Do we live in a simulated reality?

我认为我们确实生活在模拟世界中，我觉得我们就和游戏一样，我们只不过是在玩一场开放度更大的游戏罢了，我们就想游戏里的角色一样被人操控。我们的每一个选择都将影响之后的选择，预言这个东西我认为是可信的，这个就和猜东西一样，根据一个人的性格之类的去猜测最有可能的结果，预言错误我认为就是因为这个人中途发生的改变所导致的。

老师您真的好厉害！请收下我的膝盖！