# How to type binomial coefficient $\binom{n}{k}$

I know how to type a fraction as you would write a fraction in Mathematica (9). How do you type Binomial[n,k] as $\binom{n}{k}$ in Mathematica? Is there a single reference page that contains all the Mathematica operations like this, that you can type in math notation?

-
I just realized that this might conflict with typing vector notation (CTRL+Enter), so probably the way to do this is to type $\frac{n!}{(n-k)!k!}$ – Identity Dec 6 '13 at 1:56
What exactly are you trying to achieve? (1) Just display something? (2) Interpret that displayed form as Binomial? (3) Or display Binomial in that form? TraditionalForm will do (3). Use Ron's answer for (1). (2) is not simple and I don't recommend it. When talking to computers it's best to stick to a clear, unambiguous notation (which the usual math notation is not---it always relies on a human reader who understands the problem and the context). – Szabolcs Dec 6 '13 at 2:05
Here's a reason not to force these things. There's a difference between those two inputs but you can't see it. The first one was created by transforming the cell to TraditionalForm. The second one was input directly as a visual form. – Szabolcs Dec 6 '13 at 2:07
@Szabolcs to (2) type that in displayed form and have Mathematica interpret it as Binomial. Yes, a little while after I asked this, I realized why (2) would be a problem. – Identity Dec 6 '13 at 2:33

## 1 Answer

The possibility to insert operators and functions as you know them from mathematics is not possible for all things. Usually, you find the special input possibilities on the reference page of the function in the Details section. See for instance the documentation of Integrate.

For Binomial there seems to be no such 2d input, because as you already found out, $\binom{n}{k}$ is interpreted as vector.

The 2d input should in general be used with care, because it is sometimes harder to spot errors. And, when you want to copy a nice looking

into a text editor or to this site, you end up with

\[Integral]Sqrt[x + Sqrt[x]] \[DifferentialD]x


which just looks awful.

## Edit

Szabolcs came up with the idea that you could make a button for your needs. To see how this is derived, you first look at the TraditionalForm of Binomial

Binomial[n, k] // TraditionalForm


Now you go in the output cell and navigate to Cell->Show Expression

Cell[BoxData[
FormBox[
TemplateBox[{"n","k"},
"Binomial"], TraditionalForm]], "Output",
CellChangeTimes->{3.5952851298543243*^9, 3.595285236592402*^9}]


At this point, you see the you need to create the inner TemplateBox and therefore

DisplayForm[
ButtonBox[
TemplateBox[{"\[SelectionPlaceholder]", "\[SelectionPlaceholder]"},
"Binomial"], BaseStyle -> "Paste"]]


creates a button which lets you insert Binomial as correct 2d expression.

-
Here's a paste button: PasteButton[ RawBoxes@TemplateBox[{"\[SelectionPlaceholder]", "\[SelectionPlaceholder]"}, "Binomial"]]`. You could update your answer with it. – Szabolcs Dec 6 '13 at 2:21
@Szabolcs Thanks, I updated the post. – halirutan Dec 6 '13 at 2:24