Consider Exercise 1.B.6 from Linear Algebra Done Right, 3rd ed., by Sheldon Axler:

Let $\infty$ and $-\infty$ denote two distinct objects, neither of which is in $\mathbb{R}$. Define an addition and scalar multiplication on $\mathbb{R} \cup \lbrace \infty \rbrace \cup \lbrace-\infty\rbrace$ as you could guess from the notation. Specifically, the sum and product of two real numbers is as usual, and for $t \in \mathbb{R}$ define

\[t\infty = \begin{cases} -\infty & \text{if } t < 0, \\ 0 & \text{if } t = 0, \\ \infty & \text{if } t > 0, \end{cases} \quad t(-\infty) = \begin{cases} \infty & \text{if } t < 0, \\ 0 & \text{if } t = 0, \\ -\infty & \text{if } t > 0, \end{cases}\]

\(t + \infty = \infty + t = \infty,\) \(t + (-\infty) = (-\infty) + t = -\infty,\) \(\infty + \infty = \infty,\) \((-\infty) + (-\infty) = -\infty,\) \(\infty + (-\infty) = 0.\)

Is $\mathbb{R} \cup \lbrace\infty\rbrace \cup \lbrace-\infty\rbrace$ a vector space over $\mathbb{R}$? Explain.

To prove that a set is a vector space, you have to prove that its members follow the following rules: commutativity and associativity of addition, the distributive properties of scalar multiplication, and the existence of the additive identity, the additive inverse, and the multiplicative identity. A surprising number of sets follow these rules, so they can be defined as vector spaces and studied through the lens of linear algebra: for example, real functions, graph cycles, magic squares, and matrices (yes, matrices are “vectors” — “[t]he fact the entries are stacked up instead of all in a single row or column is immaterial” when you’re just adding and scaling them). It’s an interesting exercise to figure out why RGB colors are not vectors.

In the Axler problem, the rules $t + (-\infty) = -\infty$ and $t + \infty = \infty$ simulate the well-known reason why IEEE 754 floating-point arithmetic is not associative: limited precision (due to limited memory).

Let’s begin with showing why addition is not associative in IEEE 754. Consider (1e20 + -1e20) + 3.14. (1e20 + -1e20) = 0 first, and 0 + 3.14 = 3.14. Now consider 1e20 + (-1e20 + 3.14). (-1e20 + 3.14) evaluates to -1e20 because 3.14 is minuscule compared to -1e20 in magnitude. 1e20 + -1e20 = 0. So, we get different results based on where we put our parentheses: 3.14 vs 0.

The floating-point example should motivate which of these properties does not hold, and therefore why the set defined in the question is not a vector space. Specifically, $(\infty + -\infty) + 3.14 = 0 + 3.14 = 3.14$, while $\infty + (-\infty + 3.14) = \infty + -\infty = 0$. We get different results ($3.14$ vs $0$) based on where we put our parentheses. Associativity of addition does not hold, so $\mathbb{R} \cup \lbrace\infty\rbrace \cup \lbrace-\infty\rbrace$ is not a vector space over $\mathbb{R}$.

Edit on March 13, 2025: Several months after writing this post, I discovered that Stephen Boyd made the exact point of this post in one of his linear dynamical systems lectures — specifically, that IEEE doubles don’t form a vector space because addition is not associative.