---
title: "The permutations package and representation theory"
author: "Robin K. S. Hankin"
output: html_vignette
bibliography: permutations.bib
link-citations: true
vignette: >
  %\VignetteIndexEntry{representation theory}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---


```{r out.width='20%', out.extra='style="float:right; padding:10px"',echo=FALSE}
knitr::include_graphics(system.file("help/figures/permutations.png", package = "permutations"))
```

```{r set-options, echo = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", dev = "png", fig.width = 7, fig.height = 3.5, message = FALSE, warning = FALSE)
options(width = 80, tibble.width = Inf)
```

To cite the permutations package in publications, please use
@hankin2020.  Here we consider $S_9$, the symmetric group on 9
elements, and representations of its elements.  First we will load the
package and change the default print method:

```{r}
library("permutations")
options("print_word_as_cycle" = FALSE)
```

Now we will generate a couple of permutations, `a` and `b`:

```{r}
a <- as.word(char2cycle("(175296)(348)"))
b <- as.word(char2cycle("(27)(45)(89)"))
a
b
```

Now we will show a representation of $S_9$, using permutation matrices:

```{r}
M <- diag(9)
rownames(M) <- 1:9
colnames(M) <- 1:9
M
```

We will use the map $\phi\colon S_9\longrightarrow\operatorname{Aut}\left(\mathbb{R}^9\right)$ given by $\phi(a)=$ `M[a,]`.  Then


```{r}
M[a, ]
```

permutes the rows of $M$ with permutation `a`.  Note how the row
names are permuted as well as the elements of $M$.  Verifying that
$\phi$ is indeed a homomorphism---that is, $\phi(\iota)=I_9$ and
$\phi(a)\phi(b)=\phi(a\circ b)$---is straightforward:

```{r}
all(M[as.word(id, 9), ] == diag(9))
all(M[a * b, ] == M[a, ] %*% M[b, ])
```

In the second line above, note that the left hand side of the equality
is group composition, while the right hand side is matrix
multiplication.  We can further verify that
$\phi\left(a^{-1}\right)=\phi(a)^{-1}$:

```{r}
all(M[inverse(a), ] == solve(M[a, ]))
```

again with group inversion on the left and matrix inversion on the
right.

The map $\phi(a)=$ `M[,a]` is not a homomorphism:


```{r}
all(M[, a * b] == M[, a] %*% M[, b])
```

but we can "rescue" it by considering a group operation $\star$
defined by $a\star b=b\circ a$:

```{r}
all(M[, b * a] == M[, a] %*% M[, b])
```


See how the operation has `a` and `b` in opposite order from the
matrix multiplication; see vignette `order_of_ops` for a discussion of
this phenomenon from a different perspective.


```{r,label=restore_default, include=FALSE}
options("print_word_as_cycle" = FALSE)
```

# References {-}
