# Mathematical Notation for Conditional Statements

In computer science, we would write a condtional statement like so:

if (cross_product(vec_a, vec_b) = 0)
parallel = true;


But if we wanted to represent something like this mathematically, then what would be the correct notation?

• $a \times b = 0 \implies a \perp b$ – bubububub Jul 18 at 10:59
• Well, it would be $\parallel$ for parallel rather than $\perp$ for perpendicular, but yeah, I get the point. Thanks. – Ryan Walter Jul 18 at 11:10
• Yeah, I went with that one first, but got confused about the proper one to use. Good you fixed it yourself. – bubububub Jul 18 at 11:29
• Your question is quite unclear. – Yves Daoust Jul 18 at 12:57
• What is “something like this”? There is a thing called denotational semantics, which is a mathematical notation that describes exactly what your “if” statement does. But if you leave out the part where the value true is stored in a variable, for example, the denotation gets simpler. – David K Jul 18 at 15:38

You would usually use implications and arrows for it, e.g.

cross_product(..) = 0 $$\Rightarrow$$ parallel = true

to say that one follows from the other.

You could use an "if-then" statement. So, for example,

If $$a \times b = 0$$, then $$a$$ and $$b$$ are parallel.

But so far, this is still an incomplete mathematical statement, because we haven't explained what $$a$$ and $$b$$ are. So, a more complete statement would be

For every pair of vectors $$a,b \in \Bbb{R}^3$$, if $$a \times b = 0$$ then $$a$$ and $$b$$ are parallel.

There might be some ambiguity about what "parallel" means based on who you ask and how you define it (eg. is $$(1,0,0)$$ parallel to $$(0,0,0)$$?). So, to remove this potential ambiguity, we might prefer to use a more agreed upon terminology, which is that of linear dependence (two vectors are linearly dependent if and only if one of them is a scalar multiple of the other):

For every pair of vectors $$a,b \in \Bbb{R}^3$$, if $$a \times b = 0$$ then $$a$$ and $$b$$ are linearly dependent.

I prefer to write full English sentences as opposed to using logical symbols only. However, if you want to, you could say the following:

$$\forall a,b \in \Bbb{R}^3,$$ $$a \times b = 0 \implies$$ $$a$$ and $$b$$ are linearly dependent.