Mathews’s Algorithm

This web application is based on Harry Mathews, “Mathew’s Algorithm” in Oulipo: A Primer of Potential Literature, ed. and trans. Warren F. Motte Jr. (Normal, IL: Dalkey Archive Press, 1998), pp. 126-139. It offers the reader an opportunity to discover duplicities in texts and to “[track] down this otherness in language (and, perhaps, in what language talks about)”.

The procedure Mathews describes is relatively simple:

  1. Materials: Several–at least Two–Sets of Heterogeneous Elements Are Required

    Comment: The heterogeneity can sometimes be minimal, but it is nonetheless essential for the proper functioning of the algorithm. The less it is respected, the more likely the machine will simply reproduce replicas of the original sets. In theory, to avoid any chance of this happening, the rule is that in a table of n elements, n2 – (n – 2) elements must be different. (Example: in a table of 4 sets of 4 elements, 14 of the 16 elements must differ.) In practice, however, it is often possible to lower this level of heterogeneity.

  2. Arrangement
    1. All sets must contain the same number of elements.
    2. Each element in a set must have a function equivalent to or consistent with the corresponding elements of the other sets. (If, for instance, the elements are words, the equivalence will be one of grammaical function.) In other words, the elements of each set must be arranged in the same order. (Not a1b1c1d1 and c2a2d2b2 but a1b1c1d1 and a2b2c2d2.)
    3. The sets are superimposed one above the other to form a table consisting of rows (the sets) and columns (the corresponding elements). Here is a table of 4 sets of 4 elements:
      1 a1 b1 c1 d1
      2 a2 b2 c2 d2
      3 a3 b3 c3 d3
      4 a4 b4 c4 d4

      Comment: In all the examples, the number of elements in each set equals the number of sets. This is a convenience, not a requirement.

  3. Operation
    1. Shift each set n – 1 places left. (In other words, shift the second set one place left, the third two places, etc.)
      1 a1 b1 c1 d1
      2 b2 c2 d2 a2
      3 c3 d3 a3 b3
      4 d4 a4 b4 c4
    2. Read the columns downward starting with the initial elements (a) of the sets. Four new sets results:
      a1 b2 c3 d4
      a4 b1 c2 d3
      a3 b4 c1 d2
      a2 b3 c4 d1
    3. Perform the same manipulation with a shift right:
      1 a1 b1 c1 d1
      2 d2 a2 b2 c2
      3 c3 d3 a3 b3
      4 b4 c4 d4 a4
    4. Read the results upward, still beginning with the initial elements (a) of the original sets:
      a1 b2 c3 d4
      a2 b1 c4 d3
      a3 b2 c1 d4
      a4 b3 c2 d1

      In this way, from n sets 2n sets can be obtained.


You can observe how the algorithm works with a subset of Raymond Queneau’s Exercices de Style.


You can also paste elements from your own texts, beginning with the form below.

How many texts are you working with?

How many elements are in each text?

The results will be posted in a new window.

Leave a Reply

Your email address will not be published. Required fields are marked *