Step 1: Download OS X Yosemite (OS X 10.10) from the store Mac App Store for free, but do not start the installation of the OS X 10.10.
Step 2: You must create a Bootable USB (Read this complete guide here!!!)
Step 3: After preparing a bootable drive, restart the Mac, hold down the Option (ALT).
Step 4: When the machine is switched from the boot menu, select the “Installer Mac OS X».
Step 5: Open Disk Utility and select the hard drive you want to format. Click the Erase tab. From the drop-down menu, select Format Mac OS Extended (Journaled) and write the name of the desired disc.
Step 6: Click the Erase button to start formatting the drive.
Step 7: After completing the operation close the Disk Utility and select from the top menu “Install Mac OS X».
Step 8: Specify the drive and run the installation of OS X Yosemite.
After a clean install of OS X Yosemite, you can migrate your applications and other important files from a Time Machine backup or use the OS “from scratch”.