# \innerproduct

Used in quantum-mechanical bra-ket notation to typeset inner products such as ⟨\psi|\phi⟩ or ⟨\psi|\psi⟩.

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

## 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-mechanical bra-ket notation to typeset inner products such as ⟨\psi|\phi⟩ or ⟨\psi|\psi⟩.

## Examples

```latex
\innerproduct{a}
```

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

```latex
\innerproduct{a}{b}
```

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

```latex
\innerproduct*{a}
```

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

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

[Open in Playground](https://play.texform.dev/?input=%5Cinnerproduct*%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
\innerproduct{#1}{#2}
```

→

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

When unstarred. If #2 is omitted, expands to \left\langle{#1}\middle\vert{#1}\right\rangle. Starred forms use unscaled \langle and \rangle.

## Equivalent forms

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

exact. Alias implemented by the same parse method; the same optional star and optional second braced group are also accepted.

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

exact. Alias implemented by the same parse method; if the second braced group is omitted, MathJax duplicates #1 as the ket.

## See also

- [\\braket](https://texform.dev/latex/commands/braket)
- [\\ip](https://texform.dev/latex/commands/ip)

## Test cases

### physics

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