# \dyad

Used in bra-ket notation for dyads or projector-like operators in quantum mechanics.

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

## 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 bra-ket notation for dyads or projector-like operators in quantum mechanics.

## Examples

```latex
\dyad{a}
```

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

```latex
\dyad*{a}
```

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

```latex
\dyad{a}{b}
```

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

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

[Open in Playground](https://play.texform.dev/?input=%5Cdyad*%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
\dyad{#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
\outerproduct{#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

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

## Test cases

### physics

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