- Alexander Wagner

# Language of Mathematics for Technical Art: Part I - Set Theory

One of the biggest hurdles I've had to clear as a technical artist, was math. It was even a huge obstacle during my academic career. If I'm being completely honest, it continues to be a hurdle to this day. Admittedly, I have never been the greatest at math. It just does not come easy to me as the rest of my peer. Which I why it just takes more perseverance, and fascination on my end. Unfortunately, math is just one of those topics that can scare people away. I have heard this with a lot of my peers in this field as well. Speak with any experienced programmer, or senior technical director, and they will tell you that knowing more math will *ALWAYS* be beneficial in this career path.

Again, math can be an intimidating subject. If we weren't given a solid foundation to build our skills upon, then learning how to apply math concepts towards art would be even more problematic. However, allow me to shift this perspective of math from mundane numbers, and cold logic, toward something more familiar. Let's think of mathematics as a way of communicating cool ideas, and awesome solutions to the most bizarre challenges. Let's think of it, as a language.

My point being, we don't have to win a Field’s medal in order to be great at our jobs. We only have to learn how to speak the language of our mathematical peers. After all, technical artists are the bridge between the programmers, and the artists of the studio. Let’s begin!

## Set Theory

### The study of defining a collection of objects based on their mathematical relations in respect to each other.

Set Theory is how mathematicians study and define a collection of objects called elements. On a conceptual level, this area of mathematics is fairly simple. In fact most would agree this is the study about the absolute fundamentals mathematics itself. Which is exactly why this is the perfect topic to begin this series. Let's go over some Set Theory basics.

**What exactly is a "set?"**

*A set is a collection of objects referred to as, "elements."*

**What does a set look like in mathematics?**

*A set will often be visualized as a circle with the elements inside. We will also see sets in, "list notation." *

**Order does not matter in a set (list notation.)**

*{ 1, 2, 3 } = { 3, 2, 1} = { 2, 1, 3} etc...*

**Repeated elements in a set, only count/listed once.**

*{ 1, 2, 3, 3, 2, 2,1, 1} = { 1, 2, 3} *

**What is the Cardinality of a set?**

*The cardinality refers to how many elements are in that set.*

*{ 1, 2, 3, 4, 5} = |5|**{0} = |1|**{} = |0|**{{1},2,3,4} = |4|**{{}}*

*What is the cardinality of the set containing an empty set?*

It's cardinality of set e = |1|

**The most common sets you'll come across, even as a technical artist are:**

*Natural Numbers*

**ℕ** =* { 0, 1, 2, 3, ... }*

* * *Integers *

**ℤ** =* { ... , -3, -2, -1, 0, 1, 2, 3, ... }*

Rational* Numbers*

**ℚ** *=* * { 1/1, 1/2, 1/3, ... }*

Real *Numbers*

* ***ℝ ***= Includes anything from the above sets.*

Imaginary Numbers

i = *{any numbers containing... i = √ 1}*

Complex Numbers

ℂ = *any numbers real, and imaginary.*

*Note: if you read the part about imaginary and complex number sets and broke out into a cold sweat, Do Not Worry. We won't touch those concepts until way later. By that time they will be much easier to comprehend.*

## Functions & Set Theory

### Functions serve as a mapping or translation between two sets of numbers.

If you’ve ever dealt with functions in algebra before, then you already have had some experience with Set Theory. You probably just didn’t realize it at the time. In Set Theory we will describe functions as a mapping between the domain, codomain, and the range. Let’s go over what all this means with an example function.

Behold!

###### ƒ(*x*) = 2*x*+1

Now, we can substitute the variable “x” for any natural number.

Our domain for this function is any natural number. This is because we defined it this way. What would the Codomain be in this case? The codomain is essentially the copy of the domain, so it will also be all natural numbers. Now this leaves the range. Let’s graph this out first to see if we can figure out what the range is.

f(x) = 2x+1:

2(1)+1 = 3

2(2)+1 = 5

2(3)+1 = 7

2(4)+1 = 9

There is something very important to note here. Even though we are starting at the number 1 our output is only giving us odd numbers. This means that the function we are dealing with is restricting the possibilities for the output to be only odd numbers. Remember what I said earlier about subsets and supersets. If we were to look at the codomain and the range, what kind of conclusion could come to? Let's take a look at this in example 1.2.

If you guessed that the range is a subset of the codomain, then you are correct. Unfortunately there's no prize, except you giving yourself a high five.

Cool, let’s go over this again once more.

**Domain**:

The set of numbers going into a function. We would generally use the common sets described earlier for domain.

**Codomain**:

The set of all the possible numbers that could come out of the function. This can generally be considered a copy of the domain.

**Range**:

The set of all the actual output numbers from the function. This always includes elements from the codomain set.

*Note: Remember when we talked about subsets and supersets? That is applied here as well. The range of a function is always considered the subset of the codomain set.*

## Set Theory and Computer Science

### Set Theory creates the foundation of logic in modern mathematic, which computer science was derived from.

Given the basics of Set Theory I have laid out earlier, we can begin to apply some of this knowledge to computer science and its underlying architecture. In fact, after I learned the basics of Set Theory my python scripting also improved. There is an actual reason for this as well. If we were to look back on the reason this branch of mathematics was developed, we would come to understand that Set Theory was born from necessity to bring a more refined logic to modern mathematics.

When we look at a set of numbers we need to use logic in order to perform an operation with them. This is how we categorize and transform our information. Now let's bring this back towards computer science for a second. The very premise of computer science is transforming information. When programming we will begin with a set of data, and we'll use a series of logical functions to transform the data into something more meaningful.

In computer science we can look at lists/arrays, and so on, as sets. Honestly, this is because they are sets. These data structures act just like sets do. Let's look at an example of a list in Python.

```
set_a = [1,2,3,4]
set_b = [1,2,3,4,5,6,7,8,9]
set_c = [x*2+1 for x in set_a]
```

These sets should look familiar. If we were to print the result of this code to we would end up with these sets of lists:

```
set_a >>> [1,2,3,4]
set_b >>> [1, 2, 3, 4, 5, 6, 7, 8, 9]
set_c >>> [3, 5, 7, 9]
```

Sure! This is very simple python scripting. However, this will point show that the function I used to generate "set_c" is a subset of "set_b." We can also note the domain, codomain, and range with this code.

Lets take this python list example further and test our Set Theory knowledge. We can add two more sets, and look at the cardinality of these. (Remember that the cardinality is the number of elements in a set.)

```
set_a = [1,2,3,4]
set_b = [1, 2, 3, 4, 5, 6, 7, 8, 9]
set_c = [3, 5, 7, 9]
set_d = []
set_e = [[]]
```

In order to get the cardinality of these sets, wee just have to print the length of each list. This will be done by calling the len() function.

```
set_a >>> 4
set_b >>> 9
set_c >>> 4
set_d >>> 0
set_e >>> 1
```

Now this is just the tip of the iceberg when it comes to unveiling the innerworkings of Set Theory and computer science. We only looked at lists populated with number values in python, but it's good to become familiar with these concepts even if it's only on a basic level.

*Fun Fact: George Boole was an English mathematician that is best known for his work on algebraic logic. He authored the "Laws of Thought" which contains a branch of mathematics called Boolean algebra. His work laid the foundation for modern day circuitry, and programming. Have you heard of Boolean operators before? *

## Set Theory and Maya

### Technical artists can benefit from understanding Maya's architecture, and it's basis in Set Theory.

This is where we finally make the connection to technical art and Set Theory. Often we will be given a task to perform by the lead/supervisor. In this case let's go with the example of a complex face rig that utilizes F.A.C.S. In these kinds of face rigs it is ** guaranteed** that at least a few sets of poses will conflict, or stack on top of each other. As technical artists we have turned to math and logic to solve this nightmare. We'll eventually to get the how this issue is solved later, It deserves it's own article. (Spoiler:

**a**matrix math, and other mathematical magic like Shepard's method.)

*x*=bFor now let's dive into a simple Maya scene.

When we look at a model in a Maya scene we can see many things working together in unison. Let's break it down for clarity.

In Example 2.1, we can see there are four objects in the scene. Given what we learned about Set Theory, how can we apply those concepts to what we are seeing? We could say that the polyCubes are a set, and the polyShpere could be its own set. We could even say that those two sets would be a subset of a set that contain all geometry in scene. Does that set have you confused yet? No worries!

Can we apply this rule even further? Let's find out.

As shown in example 2.2, we can actually qualify each object itself as a set. Furthermore, The attributes that build the object can be considered their own sets. This is exactly how the concepts in Set Theory provide the basis for Maya's architecture. Each node in Maya is a collection attributes that link together with other nodes to perform complex behaviors. We will take advantage of these sets to create amazingly efficient, and stable, animation rigs.

If we combine the basic knowledge about sets, and our knowledge of programming, we can use the data in our scripts to perform work for us. We'll constantly be utilizing our knowledge of Set Theory, and Graph Theory, when we dive deeper into the architecture of Maya.

## Summary

We learned that we can organize a collection of objects into sets. From there we found out that we can use sets to further understand how how mathematic functions work. The relations between the input and output of a function can be visually mapped with Set Theory. We also learned that computer science heavily relies on the logic provide by Set Theory. As a technical artist we can predict the behavior of our rigs, or even tools, with a better understanding of Set Theory and the logical insight it brings us.

The purpose of this article was to bridge the gap between the art and math of Maya, by introducing the language of Set Theory. Unfortunately, it would take a lot lengthier articles to get us intimately familiar with any of these topics. Hence, this is why textbooks exist. If you're interested in learning more Set Theory or general math on your own. I always recommend these free learning resource.

__Eddie Woo on YouTube__- Set Theory__Khan Academy__- General Mathematics__3Blue1Brown__- Advanced Math Concepts