We give a counterexample.
Let $R$ be the noncommutative ring of $2\times 2$ matrices with real coefficients.
Consider the following matrices $A, B$ in $R$.
\[A=\begin{bmatrix}
0 & 1\\
0& 0
\end{bmatrix} \text{ and } B=\begin{bmatrix}
0 & 0\\
1& 0
\end{bmatrix}.\]
Direct computation shows that $A^2$ and $B^2$ are the zero matrix, hence $A, B$ are nilpotent elements.
However, the sum $A+B=\begin{bmatrix}
0 & 1\\
1& 0
\end{bmatrix}$ is not nilpotent as we have
\begin{align*}
\begin{bmatrix}
0 & 1\\
1& 0
\end{bmatrix}^n
=\begin{cases} \begin{bmatrix}
0 & 1\\
1& 0
\end{bmatrix} & \text{if $n$ is odd}\\[10pt]
\begin{bmatrix}
1 & 0\\
0& 1
\end{bmatrix} & \text{ if $n$ is even}.
\end{cases}
\end{align*}
Hence the set of nilpotent elements in $R$ is not an ideal as it is not even an additive abelian group.
Comment.
If a ring $R$ is commutative, then it is true that the set of nilpotent elements form an ideal, which is called the nilradical of $R$.
Nilpotent Element a in a Ring and Unit Element $1-ab$
Let $R$ be a commutative ring with $1 \neq 0$.
An element $a\in R$ is called nilpotent if $a^n=0$ for some positive integer $n$.
Then prove that if $a$ is a nilpotent element of $R$, then $1-ab$ is a unit for all $b \in R$.
We give two proofs.
Proof 1.
Since $a$ […]
A Ring Has Infinitely Many Nilpotent Elements if $ab=1$ and $ba \neq 1$
Let $R$ be a ring with $1$.
Suppose that $a, b$ are elements in $R$ such that
\[ab=1 \text{ and } ba\neq 1.\]
(a) Prove that $1-ba$ is idempotent.
(b) Prove that $b^n(1-ba)$ is nilpotent for each positive integer $n$.
(c) Prove that the ring $R$ has infinitely many […]
Boolean Rings Do Not Have Nonzero Nilpotent Elements
Let $R$ be a commutative ring with $1$ such that every element $x$ in $R$ is idempotent, that is, $x^2=x$. (Such a ring is called a Boolean ring.)
(a) Prove that $x^n=x$ for any positive integer $n$.
(b) Prove that $R$ does not have a nonzero nilpotent […]
The Zero is the only Nilpotent Element of the Quotient Ring by its Nilradical
Prove that if $R$ is a commutative ring and $\frakN(R)$ is its nilradical, then the zero is the only nilpotent element of $R/\frakN(R)$. That is, show that $\frakN(R/\frakN(R))=0$.
Proof.
Let $r\in R$ and if $x:=r+\frakN(R) \in R/\frakN(R)$ is a nilpotent element of […]
If the Quotient Ring is a Field, then the Ideal is Maximal
Let $R$ be a ring with unit $1\neq 0$.
Prove that if $M$ is an ideal of $R$ such that $R/M$ is a field, then $M$ is a maximal ideal of $R$.
(Do not assume that the ring $R$ is commutative.)
Proof.
Let $I$ be an ideal of $R$ such that
\[M \subset I \subset […]
Characteristic of an Integral Domain is 0 or a Prime Number
Let $R$ be a commutative ring with $1$. Show that if $R$ is an integral domain, then the characteristic of $R$ is either $0$ or a prime number $p$.
Definition of the characteristic of a ring.
The characteristic of a commutative ring $R$ with $1$ is defined as […]
Equivalent Conditions For a Prime Ideal in a Commutative Ring
Let $R$ be a commutative ring and let $P$ be an ideal of $R$. Prove that the following statements are equivalent:
(a) The ideal $P$ is a prime ideal.
(b) For any two ideals $I$ and $J$, if $IJ \subset P$ then we have either $I \subset P$ or $J \subset P$.
Proof. […]
Prime Ideal is Irreducible in a Commutative Ring
Let $R$ be a commutative ring. An ideal $I$ of $R$ is said to be irreducible if it cannot be written as an intersection of two ideals of $R$ which are strictly larger than $I$.
Prove that if $\frakp$ is a prime ideal of the commutative ring $R$, then $\frakp$ is […]