## Sudoku: Swordfish

### Swordfish

Swordfish is equivalent to X-wing and simply(!) involves an extra interlocked row and column.

Figure 1. A Swordfish hint for symbol 6. Prior to asking the program to suggest a Swordfish all occurences of symbol 6 were given a yellow background. The program has found a Swordfish for rows 5,8 and 9 and columns 4,8 and 9. Any 6s on these columns not in rows 5,8 and 9 can be removed. The program has given the single one of these a red background [click for larger image].

Understanding Swordfish

Suppose we find 3 columns, each containing exactly 3 Ss on the same 3 rows. We know that each column must contain an S, so these columns can only use an S from these three rows. It is important to realise that this means that nothing outside these three columns can influence the possible arrangements of the Ss on these 3 rows.

So, for a Swordfish, what column and row arrangements are possible? i.e when we have 3 columns in which S occurs only in the same 3 rows? Given that only these 3 columns and rows can influence the possible positions of S we can remove all other cells except those at the intersections of these rows and columns. Also ignoring all symbols other than S we are left with:

```SSS
SSS
SSS
```

(By chance this matches the column and row layout in Figure 1 - a more typical arrangement is shown in Figure 2 given below).

Given that each column and row must have exactly one S, the possible arrangements of S are:

```SSS    S--      S--       -S-      -S-      --S      --S
SSS    -S-      --S       S--      --S      S--      -S-
SSS    --S      -S-       --S      S--      -S-      S--

(A)    (1)      (2)       (3)      (4)      (5)      (6)
```

Notice how the position of one limits the other two, and that any two fix the position of the third.

To the mathematically-minded, that there are 6 is obvious: the first can be positioned in 3 ways, the next in 2, and the last is fixed. So the total is 3! = 3x2x1 = 6.

These arrangements are completely independent of any other occurrences of S in the grid. But other Ss on the same rows as our possible solutions do depend on this pattern: because our solutions are the only ones that can possibly satisfy the necessity of having an S in each column, any other Ss on these rows can be removed.

If you understand the foregoing, you understand Swordfish. However there are complications, which, though they don't alter the underlying logic and its explanation, they do make the pattern more difficult to recognise. Please read on.

Swordfish is not limited to situations where the three columns in the pattern lie in the same rows. The crucial points are that each of the cells must overlap at least one other and that the total number of columns must be three. Some examples with their only possible solutions are given below. Note that in each case the number of columns sums to 3 and that the possible solutions for these arrangements are subsets of those shown for case (A) above.

```SS    S-      S-        -S
SSS   -S-     --S       S--
SS    -S      S-        -S

(B)   (a)     (b)       (c)
```

Notice that (a),(b) and (c) are equivalent to (1), (2) and (3) in (A) above. No other arrangements are possible.

```SSS    S--    -S-    --S
SS     -S     S-     S-
SS     -S     -S     S-

(C)    (e)    (f)    (g)
```

Notice that (e), (f) and (g) are equivalent to (1), (3) and (5) in (A).

``` SS     S-     -S     -S
SS     S-     S-     -S
SSS    --S    -S-    S--

(D)    (h)    (i)    (j)
```

Notice that (h), (i) and (j) are equivalent to (3), (5) and (6) above.

It is also possible to get arrangements of the form shown below. But, once again, they only produce subsets of the 6 possibilities shown above in (A).

``` SS     S-
SS     S-      etc   etc
S S    - S

(E)

etc
etc
```

But remember we have removed all other columns, so in an actual grid the columns can be separated; for example, as below:

```(F)

S   S

S   S     S

S         S
```

etc. And so the pattern can be much harder to spot.

And finally, all the above arguments apply equally if we reverse the roles of rows and columns.

Figure 2. A Swordfish hint for symbol 1 [click for larger image].