# \outerproduct

Used in quantum mechanics to denote outer products or rank-one operators such as |\psi\rangle\langle\phi|.

https://texform.dev/latex/commands/outerproduct

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Physics: bra-ket](https://texform.dev/latex/topics/physics-braket) |
| Packages | physics |
| Allowed mode | math |
| Tags |  |
| Commonality | low |
| Kind | prefix |

## Syntax

### physics

Argument specification: `s m g`

Used in quantum mechanics to denote outer products or rank-one operators such as |\psi\rangle\langle\phi|.

## Examples

```latex
\outerproduct{a}
```

[Open in Playground](https://play.texform.dev/?input=%5Couterproduct%7Ba%7D)

```latex
\outerproduct*{a}
```

[Open in Playground](https://play.texform.dev/?input=%5Couterproduct*%7Ba%7D)

```latex
\outerproduct{a}{b}
```

[Open in Playground](https://play.texform.dev/?input=%5Couterproduct%7Ba%7D%7Bb%7D)

```latex
\outerproduct*{a}{b}
```

[Open in Playground](https://play.texform.dev/?input=%5Couterproduct*%7Ba%7D%7Bb%7D)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| physics | full | none | full |

## In TeXForm

TeXForm parses this entry as prefix syntax; the package determines its argument specification.

### Expands to (physics)

```latex
\outerproduct{#1}{#2}
```

→

```latex
\left\vert{#1}\middle\rangle\!\middle\langle{#2}\right\vert
```

This is the unstarred two-argument branch. If the second argument is omitted, MathJax reuses #1 in its place; the starred form instead reparses \vert{#1}\rangle\!\langle{#2}\vert without \left/\middle/\right sizing.

## Equivalent forms

```latex
\dyad{#1}{#2}
```

exact. Same MathJax parser behavior, including the optional star and the omitted-second-argument default to the first argument.

```latex
\ketbra{#1}{#2}
```

exact. Same MathJax parser behavior, including the optional star and the omitted-second-argument default to the first argument.

```latex
\op{#1}{#2}
```

exact. Same MathJax parser behavior, including the optional star and the omitted-second-argument default to the first argument.

## See also

- [\\dyad](https://texform.dev/latex/commands/dyad)
- [\\ketbra](https://texform.dev/latex/commands/ketbra)
- [\\op](https://texform.dev/latex/commands/op)

## Test cases

### physics

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \outerproduct{a} | Positive: baseline | Pass | Fail | Pass |
| \outerproduct*{a} | Positive: vary:s[0] | Pass | Fail | Pass |
| \outerproduct{a}{b} | Positive: vary:g[2] | Pass | Fail | Pass |
| \outerproduct*{a}{b} | Positive: maximal | Pass | Fail | Pass |
| \outerproduct a | Positive: bare[1] | Pass | Fail | Pass |
