Here’s a cool chain of info nuggets that starts @ Renè Descartes and ends @ Ruby’s Array.product, lol.

Renè Descartes was a French philosopher and mathematician born in 1596.

He’s known for lots of things but one of the most popular is the following quote from a passage in his publication Discourse on Method (1637):

“**I think, therefore I am**” (or the corrected version “**I am thinking, therefore I exist**“)

Renè Descartes developed “analytic geometry”, an algebraic description of geometry. A pair of numbers can represent a specific coordinate on a plane or graph. Sets of coordinates can be represented on a graph as well… and this gets us closer to the end of this nugget chain…

“Analytic geometry” is also known as “Cartesian geometry”… with the name stemming from Descartes’ own name. In the Cartesian view, when given a plane (think … graph), any point on the plane can be represented by coordinates — in a 2 dimensional plane these might be **X** and **Y**, in a 3 dimensional space this might be something like **X, Y **and **Z.**

A **cartesian product** is the result of taking two sets and returning all permutations of their combined results. So for example, if you had a set of numbers named **X** that contained: “1,2,3″ and a set of numbers called **Y** that contained “-5,-6,-7″, their cartesian product would be:

[1, -5], [1, -6], [1, -7], [2, -5], [2, -6], [2, -7], [3, -5], [3, -6], [3, -7]

And finally getting back to Ruby…. this is where Array.product gets it’s name!

Array.product is **awesome** and will get you the Cartesian product for a given array against a number of other arrays!

/fin