Modern, downloadable versions of OS X create a recovery partition on. Back in the day when we bought OS X on discs, as long as you kept that disc, you always had a bootable installer just in case. Macworld also has bootable-install-drive instructions for: mac OS High Sierra (10.13) El Capitan (OS X 10.11) Yosemite (OS X 10.10) Mavericks (OS X 10.9).