Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Most computer programming languages have constructs for managing arrays of data, including multiple-dimensional arrays, which are clearly useful when storing, manipulating and modelling mathematical arrays/matrices.

Most of these languages also support empty arrays, i.e. ones with a length of zero in at least one dimension.

Are such arrays useful in mathematics, or are they simply a programming nicety?

And do they have real-world applications?

share|improve this question
6  
The empty set?? –  AnonSubmitter85 Jun 24 at 20:19
5  
Perhaps more to the point, the trivial vector space. –  Harald Hanche-Olsen Jun 24 at 20:21
1  
Classical vector spaces include the Euclidean spaces, set of matrices, or higher dimensional tensor spaces – involving multidimensional arrays, if you wish. But also subspaces of these, which are the solution sets of systems of linear (homogeneous) equations. Sorry, this space is too small for a whole introduction to vector spaces. Try wikipedia, perhaps? Anyhow, the trivial vector space has only one member: The zero vector. –  Harald Hanche-Olsen Jun 24 at 20:33
1  
@Harald: More to the point? –  Eric Stucky Jun 25 at 6:08
1  
@jpmc26: It is usually convention that the empty sum is equal to zero. By coordinates I assume you meant something like: choose a basis, write it in that basis, pick off the coefficients. But for the trivial vector space, the basis is the empty set, and the sum for an arbitrary component is the empty sum, so there are no coefficients. In that sense I would say that a zero vector actually does not have coordinates. (Hm, I guess would rather say: the number of coordinates it has is zero, which I'm not sure I want to mean the same thing. But that should still be enough to make the analogy.) –  Eric Stucky Jun 25 at 6:11

6 Answers 6

up vote 6 down vote accepted

The empty string $\epsilon \in \Sigma^*$ (the set of all strings with finite length) in automata theory and formal languages (theoretical CS). It is the neutral element of string concatenation.

Also if $L$ is a formal language, $L^0 = \{ \epsilon \}$ arises.

Addendum:

I was maybe exposed too much to C-like programming languages that I immediately associate arrays with strings. :-)

The proper mathematical equivalent of an array is probably the sequence over some finite index set $I$ into some set $A$:

$$ (a_k)_{k \in I} \in A^I = \left\{ a \, \left| \, \right. a : I \to A \right\} $$

That definition should include the more general associative arrays, where $I$ is not some subset of $\mathbb{N}$.

If the index set is the empty set $I = \emptyset$, we got the empty array, like the map $b : \emptyset \to \mathbb{C}$. I see no exiting use for that one. We can define the concatenation of arrays, and have it be the neutral element. But we had this with strings already.

To represent a string, a list data structure $L = [a, b, c ]$ is sufficient, where direct access to all stored data is not necessary, just access at the head $L = [H|T]$ is enough and order is preserved (it is not just a set), the functional languages and PROLOG like this model. However there recursion is used regulary, and the empty list $[]$ occurs naturally, for example in a clause that does not spawn anymore recursive call, at the leaves of a recursive call tree for a function that works on lists.

share|improve this answer
    
Looks like I've some light bed-time reading ahead of me! Can you recommend a good starting place, or is google's "I feel lucky" as good as anywhere? –  ClickRick Jun 24 at 20:33
1  
The English language wikipedia article on concatenation is not that good (compare to this one: Konkatenation), but maybe this one might give a first start: Kleene Star or Formal Language. –  mvw Jun 24 at 20:38
1  
My category theory is pretty sketchy, but I'm pretty sure that empty map is an initial (terminal?) object in some suitable category, and useful as such... –  Steven Stadnicki Jun 25 at 4:28
    
+1 for neutral element. It's generally a good idea to make your semigroups into monoids if you can get away with it :) –  askyle Jun 25 at 7:44

Mathematically, it is useful to have length be a nonnegative (not just positive) measurement. Then, we can do things like, given arrays $A,B$, define $C$ to be the largest array that agrees with both $A$ and $B$ for all its entries (agreement checked from the first entry onward). If $C$ cannot be empty, this definition can't be made.

share|improve this answer
    
+1 for removing special case checks. It's much related to the empty array being a neutral element for union (as this other answer points out). –  askyle Jun 25 at 7:50

If you're talking about applications in computer programming, suppose you initialize an array $A$ to the empty array, and then at some point in the program, which may be reached repeatedly, you do an operation that puts together the $n\times k$ array $A$ with the $n\times\ell$ array $B$, where the values of both of those change while the program is getting executed, to get the $n\times(k+\ell)$ array $[A, B]$.

I can imagine that being useful.

As for its utility in mathematics: I won't be surprised if in some situations it's useful, but I don't know what those are.

share|improve this answer

In programming it is useful for the Null Object Pattern. This simplifies the use of functions by mandating they always return a non-null value. Null values in programming an issue as they cannot be dereferenced without causing a runtime error as they point to literally nothing (apart from ruby)

e.g. With the function getValues() returning an empty array when there are no results

for (Integer value : getValues()) {
}

e.g. With the function getValues() returning NULL when there are no results forces us to make an extra check and complicates our code

Collection<Integer> values = getValues();
if (values != null) {
  for (Integer value : values) {
  }
}
share|improve this answer

In the category of Set, the empty set is the only initial object. I found that example, along with the fact that all one element sets are the terminal objects of Set, useful in understanding initial and terminal objects in general.

Also, it is possible to construct useful objects using nothing but the empty set and the basic operations of set theory: Set-theoretic definition of natural numbers

There are important differences between the concepts of arrays and of sets (sets have no order and contain no duplicates), but an empty set could still be thought of as analogous in some way to an empty array since they are both collections that contain no elements.

share|improve this answer
    
Real world applications and talking about the category of Sets is quite an oxymoron. Not to mention that the OP pointed out that they have considered the empty set already. –  Asaf Karagila Jun 25 at 4:22
    
@AsafKaragila Oh I missed that part. He asked for applications in math too, which is why I mentioned category theory. Also, wouldn't an indexed family N -> X (for some X) be more or less equivalent to an array? And couldn't you consider an indexed family to be defined in terms of the set of its input/output pairs? In that case, it seems like an empty array would pretty much be an empty set, but maybe I'm stretching a little too far. –  David Young Jun 25 at 4:55
    
I meant to say "[...]an indexed family J -> X for some X and J being a subset of N (in this case, the empty set)[...]" –  David Young Jun 25 at 5:04

Imagine you have a function (either in programming or in mathematics) whose output is an array. It's easy to imagine that some inputs will naturally yield the empty array as an output -- but you may not know, at least at first, which inputs have this property.

It's very convenient not to have to keep checking whether or not you're removing the last element from an array.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.