Let’s start with the word “pencil.” It comes from a Latin word meaning “little tail.” The writing instrument is made up of a casing that protects a solid pigment core. (By the way, pigment comes from the Latin pingere,” which means “to color or paint.”)
The stylus, a thin, metal stick made from lead, may have been the earliest pencil. This tool was used in ancient times for writing on wax tablets.
As for the ubiquitous and enigmatic No. 2, the answer is boring in its practicality. The number represents the hardness of the lead ― the lower the number, the softer the metal. Early machines that scanned and scored tests couldn’t detect marks made by hard pencil leads. Marks from by No. 3 and 4 pencils resulted in erroneous results.
In a Goldilocks moment, No. 2 pencils were just right.
The yellow (butterscotch?) shade apparently began to dominate the pencil industry in the late nineteenth century. At that time, pencils were either painted dark colors or not at all. Then, a company based in Austria-Hungary introduced a new, expensive brand of pencil that was painted yellow to distinguish it from other pencils. Other companies proceeded to do what you should never do on an exam: copy.