Update 2016.08.28: blog post replaced. please click here for new post.
Sadly Apple no longer include restore discs with their machines, that doesn’t mean you can’t reinstall though. It’s fairly simple to create a bootable USB installer for Yosemite. All you need is a USB memory stick that’s 8GB or larger. Make sure you back it up first.
You simply need to download Yosemite for free from the Mac App Store (link here) and then run the following command in Terminal, just ensure you replace “MyVolume” with the name of your own USB volume.
sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/OS\ X\ Yosemite\ Installer --applicationpath /Applications/Install\ OS\ X\ Yosemite.app --nointeraction
Once you’re done you can easily boot from the installer stick by holding down the Option key (ALT) on boot and selecting the installer. Easy.