Variables and Equations

Reference

A={xproperty}A = \{ x | property \}

  • N\mathbb{N} is the set of Natural numbers (positive integers including zero).

  • Z\mathbb{Z} is the set of Integers numbers (also negative).

  • Q\mathbb{Q} is the set of Rational numbers (fractionals).

  • \cup is the union operator symbol.

  • \cap is the intersection operator symbol.

  • \setminus is the union difference symbol.

  • \in is the "belongs to set" symbol.


  • A statement "A" can be only True or False

  • \lor is logical or

  • \land is the logical and

  • ¬A\lnot A indicates the negation of "A"

  • x(statment)\exists x(statment) indicates that the "x" present in the statement is a variable that makes the statement True for "at least" a value of x.

  • x(statment)\forall x(statment) indicates that the "x" present in the statement is a variable that makes the statement True for "all possible" values of x.

  • A    BA \iff B is a "if and only if", making A and B having the same truth value.

Here's a recap of some properties:

  • Commutativity: ab=baa \circ b = b \circ a

  • Associativity: x(yz)=(xy)z=xyz x \circ (y \circ z) = (x \circ y) \circ z = x \circ y \circ z

  • Identity element e: ex(xe=ex=x)\exists e \forall x (x \circ e = e \circ x = x)

  • Zero element e: ex(xe=ex=e) \exists e \forall x (x \circ e = e \circ x = e)

  • Distributive: x(yz)=(xy)(xz) x \circ (y \Box z) = (x \circ y) \Box (x \circ z)

  • Inverse: x(yz)=(xy)(xz) x \circ (y \Box z) = (x \circ y) \Box (x \circ z)


  • Addition: Commutative, Associative, Identity on 00

  • Subtraction: Inverse of Addition

  • Multiplication: Commutatiive, Associative, Identity on 11, Zero element on 00, Distributive over Addition

  • Division: Inverse of Multiplication, Distributive over Addition (and Subtraction)

Variables and Equations

We're going to introduce a bit more logic in this chapter, and define in a logical manner what equations are, along with introducing the concept of relationships. This is usually not how the concept is introduced, but I feel like to go in a structured manner, we need to tackle a lot of logical foundations, that otherwise we just take for granted.

First of all, some extra set and logical notation

We talked about sets a little. We extend the number of "operators" we know by introducing the following "contained in" symbol \subseteq. This symbol looks a bit similar to \in, and rather than meaning that a single element is contained in the set (e.g. xNx \in \mathbb{N}), we are meaning that a set is fully contained within another. That is, in the expression ABA \subseteq B we are saying that "Every element of A is also an element of B". B could contain more elements, but all of the ones in A are represented. This relation symbol is called subset of.

In logical form:

AB=xA(xB) A \subseteq B = \forall x \in A (x \in B)

The above can also be represented with the form:

AB=x(xAxB) A \subseteq B = \forall x (x\in A \rightarrow x \in B)

The \rightarrow symbol means "implies". In the statement ABA \rightarrow B, the whole statement is always True, except in the case where A is True but B is False. So it gives us a guarantee that if that implication holds, we're sure "B holds if A holds (at least)".

AABBABA \rightarrow B
FFT
FTT
TFF
TTT

Of course, in this formulation, the set "B" doesn't have to be equal to the set "A", the important thing is that it contains at least all the elements of "A". If we instead want to declare it strictly bigger, we use the symbol \subset, and declaring ABA \subset B implies B strictly bigger. What that logically means is this:

AB=x(xAxB)x(xBxA) A \subseteq B = \forall x (x\in A \rightarrow x \in B) \land \exists x (x \in B \land x \notin A)

That is, the previous statement about B containing every element of A is kept, but we add the constraint (by adding it with a "logical and" \land) that exists an element in B that is not in A (that's what \notin means).

For convenience, the two symbols have a mirrored version in ,\supset, \supseteq, which is just the same operators, but with the two sets inverted.

AB    BA A \subset B \iff B \supset A

and

AB    BA A \subseteq B \iff B \supseteq A

. I had to use     \iff rather than == there, because I am comparing differing statements, rather than values. The     \iff operator behaves like the == symbol, but only works on logical statements, making sure those are basically equal ways of expressing the same concept.

Relations and equality

Now we have to truly tackle the issue of, what really is the operator ==? On numbers, it was a bit self evident that it would be comparing values, rather than expressions, but why does it not make sense to do things like (1=2)+(3=4)(1 = 2) + (3 = 4)?

The answer to the previous questions is that we have to talk about relations. And to talk about that, we introduce something seemingly unrelated first.

Tuples

Right now, we've assumed that mathematical values are just statements with a truth values, or numbers. The true answer here is that anything that is an element of a set, is a value that we can manipulate, independent of how it's structured. As long as we define operators that work on those elements, we can build any expression we want out of all the values we want.

If we defined set A=a,b,cA = {a,b,c} and an operation \circ working as such:

xxyyxyx\circ y
aaaaaa
aabbbb
aacccc
bbaabb
bbbbbb
bbcccc
ccaaaa
ccbbcc
ccccbb

We can now express writings as:

(ab)c (a \circ b) \circ c

Simplify:

bc b \circ c

Simplify:

c c

So, no matter our "elements", as long as we define operations on them, we can write out any kind of expression we want.

So, we introduce a new kind of element, written as such:

(x,y)(x,y)

This is an "ordered pair"/"tuple", where both "x" and "y" are going to be elements from other sets, but the important thing here is that "x" comes before "y". Since we have not defined anything about them, we cannot do yet operations such as

(x1,y1)+(x2,y2)=???(x_1,y_1)+(x_2,y_2) = ???

But we could define them to be pairwise for example, the important thing is the definition of our operators. Also, of course, these are not "sets", because in sets, the element ordering does not matter.

(x,y)(y,x)(x,y) \neq (y,x)

Also when I talk about elements, elements could technically be sets themselves, or tuples. That's why when we specify "x" and "y", we always declare what sets "x" and "y" are picking values from.

And now we define what we call cartesian product. When talking about a tuple, we need to be clear where the elements come from. So we define a set where our tuple (in its entirety), can take values from.

A×B={(x,y)xAyB} A \times B = \{ (x,y) | x \in A \land y \in B\}

Let's say set A={1,2}A = \{1,2\} and set B={a,b}B = \{a,b\}. A possible value zz could take the form (1,a)(1,a) but not (a,1)(a,1) as we said order is important. All the possible values are:

AABBA×BA \times B
11aa(1,a)(1,a)
11bb(1,b)(1,b)
22aa(2,a)(2,a)
22bb(2,b)(2,b)

Even though we started with only 2 elements per set, we end up with 4 in total. This is the reason why it's called product, as it's multiplying the set cardinalities (how many elements each set has) together. In mathematical notation:

A×B=AB |A \times B| = |A| * |B|

So A=2|A| = 2 and B=2|B|=2 in our case, therefore the cardinality of the product is 4.

Relations

We can now define what a relation is. A relation is an operator of the form aRba R b, where it outputs a "logical statment" with a truth value, depending on whether the tuple (a,b)(a,b) is in RR, where "R" is defined as:

R(A,B)A×B R(A,B) \subseteq A \times B

That is, a relation is a subset of the cartesian product of the two sets "A" and "B" that we choose.

Let's be a bit more concrete and have an example. Let's look at equality over the lenses of naturals only.

Eq(N,N)N×N Eq(\mathbb{N},\mathbb{N}) \subseteq \mathbb{N} \times \mathbb{N}

So, when writing a=ba=b, we're testing whether (a,b)Eq(N,N)(a,b) \in Eq(\mathbb{N},\mathbb{N}). Ergo there's a subset of the cartesian product of naturals with themselves, formed by tuples like (20,20)(20,20) or (0,0)(0,0), but not with (10,20)(10,20). Ergo, the relationship shown here is simply testing that both sides of the "=" operator are actually the same value.

To get back to a previous article, if we were testing to see if x=a+2xx=a+2*x, we could technically multiply both sides by zero, we end up with x0=(a+2x)0x*0=(a+2*x)*0, and therefore 0=00=0, which does test True, but does not get us any closer to finding out what values of "x" make the previous equation correct.

x=a+2xx=a+2*x xx=a+2xxx-x=a+2*x-x 0=a+x0 = a + x 0a=a+xa0 - a = a + x - a a=x -a = x

Therefore we have that the tuple (a,x)(-a,x) has to be in the relation Eq. Also, this relation Eq, can be extended to different sets, and not just N\mathbb{N}. As a foreshadowing to the future, we could have equations that are satisfied for multiple values of "x", and therefore produce multiple tuples of (x,)(x,\ldots) that are in the Eq relationship. Conversely, we could find out that there are some equations that produce no possible result of "x" that satisfies the constraint of equality, so they produce no tuple that is in the relation.

An example of the latter is if we were only checking the sets of natural numbers:

x=5-x=5 x=5x=-5

We now have the tuple (x,5)(x,-5), which while possible, is not part of Eq(N)Eq(\mathbb{N}) (denoting equality only in the sets of natural numbers).

We'll look a bit more in depth at what relations are in the next article, and some examples apart from just equality. For now, you can think of equality as an binary (two arguments) operator ==, where the two arguments have the same exact "value". Concatenating == such as

3=2+1=313=2+1=3*1

is to denote the tuples (3,2+1)(3,2+1) and (2+1,31)(2+1,3*1). Of course, both of these simplify to the same form of (3,3)(3,3). When looking at inequalities, we'll see what properties these relations have, in the same manner as we did for operators and their laws.

CC BY-SA 4.0 Anwill. Last modified: January 13, 2025. Website built with Franklin.jl and the Julia programming language.