# 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 m×n 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 two from row one 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?

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

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

For me, if I really live in the simulation, I will feel terrible, I don’t like it, I am not reconciled, why my life is planned by others. If I really live in a simulation, then I am just data to them, and if I can generate that kind of thought, will it be the same as when we invented artificial intelligence, when artificial intelligence has its thoughts , how would they think? And the anime we watch, if the characters in it become conscious, will they feel that they are living in a simulated world?

Predicting the future is very interesting. The laws of the world we live in are gradually being discovered by us. Through these laws we discover, we can predict the future. (Well, there is also an example of dreams predicting the future in Freud’s “The Interpretation of Dreams”. At that time, I couldn’t understand the book, and I didn’t understand why I could dream and dream about the future.)

In the past, I would always feel that for events with many uncertain factors in real life, is the probability we obtained through calculation accurate? Is it reliable?

But later I recalled the mathematical analysis, probability theory and mathematical statistics I learned, etc. I think, as long as the parameters are selected well, we can judge his direction. Although there may be changes, as long as the changes are within the normal range, our prediction can be said to be accurate. And our physical formula, I think our physical formula can be regarded as predicting the future.

However, in mathematics, there will be irregularities. If you think about it carefully, isn’t irregularity a kind of regularity? It seems irregular, but in fact there is regularity. It is a kind of irregularity found in regularity, isn’t it?

After development, we have discovered more and more laws in this world, but at the same time, there have also been many unsolved mysteries.

The universe is a very big mystery. Our earth has many laws, so it is conjectured that there may be many laws in the universe, but we have not discovered it yet. But does the universe really have laws?

I suddenly thought of dimensions. Our current real world is a three-dimensional world, and adding time is a four-dimensional world. In the four-dimensional world, we can go to a point in time at will without affecting ourselves. So assuming that I am a four-dimensional creature, I think, can I have an immortal body? If I am a four-dimensional creature, I think, I will not die, I will not grow old, um… In this case, what is the ideology of a four-dimensional creature? Is it possible that four-dimensional beings do not have old concepts? I guess, will the body of this universe we live in be a four-dimensional creature?

Paper is two-dimensional, and I can change it at will, but we cannot have a dialogue with it. In this way, we cannot talk to creatures at high latitudes. In that case, can Siwei create us casually! ? If there is really four dimensions, it is possible for us to be in a simulated world?

……………………How did that universe come out! ! ? ?

If there are four dimensions, is it possible for there to be five, six, seven…infinity?

If there is no fourth dimension, then all of this is just our imagination… um… forget it, let’s stop here, I’m a little confused now

(I translated it with a translation software, but I don’t know if the translated English content will be different, so I sent it in both Chinese and English-(๑˙ー˙๑)-)

中文：

对于我来说，如果我真的活在模拟之中，我会觉得可怕，我不喜欢，我不甘心，我的人生为什么是被别人计划好的。如果我真的活在模拟之中，那对于他们来说我就是数据而已吧，并且如果我会产生那种思想，那么是不是就会和我们发明人工智能一样，当人工智能有了它的思想，它们会怎么思考呢？还有我们看的动漫，如果里面的人物有了意识，他们会不会觉得他们生活在一个模拟世界里呢？

预知未来很有趣，我们现在身处的这个世界里的规律逐渐被我们发现，通过我们发现的这些规律我们就可以预知未来。（嗯，还有弗洛伊德的《梦的解析》里，有梦预知未来的例子，当时看书看不明白，有点不太理解为什么能做梦，梦到未来的。）

在以前，我会总是会觉得，那种在现实生活中的不确定因素很多的事件，我们通过计算的而得来的概率准确吗？可靠吗？

但是后面我有回想起我学的数学分析，概率论与数理统计等等。我想，是不是只要参数选的好，我们都是可以判断他的走向，虽然可能会有变动，但是只要变动在正常范围内，我们的预知也是可以说是准确的。还有我们的物理公式，我想我们的物理公式可以算是预知未来的吧。

但是，在数学里，会存在无规律的。仔细再想想，无规律不就是规律里的一种吗，看似无规律，但实则是有规律的，它是在规律里发现的一种无规律，不是吗？

经过发展，我们发现了这个世界越来越多的规律，但同时，也出现了许多未解之谜。

宇宙是一个非常大的谜团。我们的地球有很多规律，那猜想宇宙可能也会存在许多规律，只是我们还没有发现。但是宇宙真的一定是有规律的吗？

我突然想到了维度，我们现在的现实世界就是三维世界，加上时间就是四维世界。那在四维世界里，我们可以随便走到一个时间点，对自己没影响的那种。那假设我是四维生物，我想，我是不是就能拥有不死之身了？如果我是四维生物，我想，我是不是不会死亡，不会变老，嗯……这样的话，四维生物的意识形态是什么呢？有可能四维生物没有老的概念？我猜想，我们身处的这个宇宙的本体会是一个四维生物吗？

纸张，是二维的，我能够随便去改变它，但是我们不能和它进行对话。按这样来说，那我们是无法去跟高纬度的生物对话。那这样的话话，四维是不是可以随便创造我们！？真的存在四维，我们就有可能身处一个模拟世界？

…………………………那那那宇宙又是怎么出来的！！？？

如果存在四维，是不是就有可能存在五维、六维、七维……无穷无尽？

如果不存在四维，那这一切只是我们所想象的话………嗯……算了，就到这里吧，现在有一点点糊涂了

（我用翻译软件翻译了一下，但是不知道翻译的英文内容会不会有差别，所以我中英文都发出来一下-(๑˙ー˙๑)-）