The pencils at first were 18. Students borrow some and this number is not given, but we can call this number x (that is, unknown).
6 pencils are left at the end of the day, and this means;
[tex]\begin{gathered} 18-x=6 \\ \text{Collect all like terms and you'll have} \\ -x=6-18 \\ -x=-12 \\ \text{Multiply both sides by -1 and you'll have,} \\ -x(-1)=-12(-1) \\ x=12 \end{gathered}[/tex]That means 12 pencils were borrowed.
Also answer option 2 is the correct equation to arrive at the correct answer