# Why is this expression not working?

    $$\sum_{k=0}^{n} \binom{n}{k} = 2^n$$


Do I need a special package, or is something else wrong with this?

• You had not insert display math environment inside inline math environment! Should be $\sum_{k=0}^{n} \binom{n}{k} = 2^n$. Mar 31, 2022 at 15:22
• you can not have $ inside  use  for inline math or \[ for display math, not both. Mar 31, 2022 at 15:22 • also \binom is not defined by default, (comes from amsmath) Mar 31, 2022 at 15:23 • You wrote   \sum_{k=0}^n ...   which seems to be over complicated. Mar 31, 2022 at 19:31 • thanks, to give some context the problem is it doent display it right when i pput , the limits of the sum are not above and below sigma , i dont know how to do this Apr 2, 2022 at 10:37 ## 2 Answers It seems you are struggling with some very basic tasks of LaTeX. Please consider consulting an introductory text. You can find an exhaustive list here: You are trying to nest displayed math inside inline math. This cannot work. You can only use one of the two at a time. Display math is introduced by \[ ...$ whereas inline math is delimited by $...$. Without context it's hard to say which one is more appropriate here, but I guess it is display math (i.e. centered horizontally and on a separate line).

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\sum_{k=0}^{n} \binom{n}{k} = 2^n$

\end{document} • Thanks for the quick answer. Apr 2, 2022 at 10:33
• I did use latex some time ago, but i forgot even that little i knew in what now im 1000 lines in and i didnt know about this [] function. Apr 2, 2022 at 10:35
• But its not what i need, cause i want the equation in a sentence so i need , but then it doesnt display the limits of the sum the same way, above the sigma symbol. Apr 2, 2022 at 10:36
• @Matko That is on purpose, so that the vertical height of the sum doesn't open up the line too much. If you don't care about that you can use $\sum\limits_{k=0}^{n} \binom{n}{k} = 2^n$. Apr 2, 2022 at 18:22
• Oh yea that's what I wanted thanks. Apr 3, 2022 at 19:48

You can use the command \displaystyle in an inline expression (with $...$) to have equations displayed as in isolated math mode (the one you obtain with $...$).

In your example, it would be: $\displaystyle\sum_{k=0}^n \binom{n}{k} = 2^n$.

• Your suggestion is possible, but not recommended. Using it lead to very poor typography. That is reason why latex has different formatting of in-line math from displayed ones. Also it not explain the OP problem. Apr 5, 2022 at 16:14
• According to the comments of OP, that was what he was trying to achieve by combining $...$ and $...$. Though it is not proper typography, it can prove useful in some context, and it is the author decision to make. Apr 6, 2022 at 11:56