If you refer to the Rambam’s 14 criteria for enumerating the 613 mitzvos, you will see that the final principle there is that the imposition of penalties are counted as positive commandments. We will address this concept more fully in our analysis of the Rambam’s criteria. For now, let’s just go with it.
There are four types of capital punishment under Torah law: burning, stoning, decapitation and strangulation. Strangulation – “chenek” in Hebrew – is the “default” punishment, i.e., the one used unless otherwise specified. (See Talmud Sanhedrin 52b.)
The reason for this mitzvah is obvious: these penalties serve as a deterrent to rampant crime and anarchy. The threat of death is intended to dissuade those so inclined from murdering others. (There was, however, a legal process to be followed, including warning, witnesses, etc. Death penalties were not just handed out indiscriminately in Biblical times.)
Strangulation was carried out by burying the convicted felon up to his knees. A cloth was wrapped around the condemned killer’s neck, which was pulled from both directions until he died.
Ramban (Nachmanides) does not count the four manners of capital punishment as four positive mitzvos, as the Rambam does. Rather, he considers the obligation to purge our communities of evil (Deut. 17:7) as a general commandment and the four forms of execution as details. The Sefer HaChinuch cites Exodus 21:12 as the source of this mitzvah, but the Rambam actually cites 21:16, “he shall surely die.” To cite that as the source, however, would reverse the order of this mitzvah and the next (which is from 21:15), so we have decided to follow the order of the Sefer HaChinuch.
This mitzvah only applies to the courts in the time of a properly-ordained Sanhedrin, rather than to individuals. It is discussed in the seventh chapter of the Talmudic tractate of Sanhedrin, particularly on pages 52b-53a. In the Mishneh Torah, it’s in Hilchos Sanhedrin chapter 14. It is #227 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos.