Allow me to elaborate further:
A hard disk is a rapidly rotating disk.
A hard disk reads with a so called actuator.
This actuator can be compared to the needle of a gramophone.
An old device for playing music.
As the cylinder or disc rotates, a needle or other similar object on the device traces the wavy lines and vibrates, reproducing sound waves.
This same sort of technique is used for reading and storing data from and on the rotating disk of the hard drive.
This rotating disk contains sectors.
These sectors can be filled with data.
When a file is being saved onto the hard disk the sectors of the disk get filled with data.
As soon as one sector is on it's full capacity a next sector will be used to store the data.
This means that one file that consists of a lot of data can be distributed over several different sectors.
The hard disk also contains a part that's different from the sectors, I forgot the official name but let's call it the legenda.
There's a small file in there which is called info.txt in this file is a legenda of which sector contains what data and which data combines into a file.
Including information on which applications open which files, what the path of these files are etc.
In order to read the combination of data on several different sectors to open up files or applications or whatevers.
The actuator needs to find the fastest path between those sectors.
Which is done through reading the info.txt file.
As I've explained before whenever a file gets removed from the hard drive a so called flag will be added to the file.
This will be added into info.txt which means the data that is needed to read or write to that file are still in the sectors.
Whenever new data get's stored the actuator checks the legenda for files that are marked with the flag of being removed.
Meaning that it's telling the actuator that the new data may overwrite the sectors where the data is stored for the file that is being marked as removed.
Whenever the new data is less then the total data of a file that is marked as being removed and has overwritten that data, this means that the file that was marked as being removed is physically partially removed.
Causing it to be corrupt and can not be read anymore by any application because it simply misses the data that was overwritten.
This can cause "gaps" inbetween sectors.
Meaning that the data from 1 file that was written on for example 3 sectors next to each other can now have data of the newly saved data on the second sector and data of the corrupt file on the first and third sector.
By defragmentating your hard drive your basically moving data that form a file from several different sectors to sectors that are not being used and nicely allined next to each other.
Causing them to be easilly accessible by the actuator since the disk then does not have to rotate as much to find parts of the data it needs to open or read the file.
The corrupt files or.. Partially data of a file that is still marked to be removed are called fragmented files, and when defragmentating they are also put next to each other so that the actuator can simply overwrite them in a way that new files can be stored on sectors that are next to each other.
Now that you know how a hard drive works and why defragmentating speeds up the process of finding combined data to open files, let me explain to you why Sold State Drives are a lot faster then Hard Disk Drives:
Solid State Drives use chips instead of sectors.
These chips can be used to store the data.
A solid state drive however does not read data through a actuator and rotating disk, but through other chips which are programmed to access data simultaniously.
So a hard drive rotates it disk and uses an actuator to read the data inside the sectors one by one untill it has found all the data in order to open up a file or application.
While a solid state drive simultaniously accesses chips in order to read the data at the same time instead of having to go through them one by one.
This is the reason why the read and write speed of a solid state drive is way higher then that of a hard disk drive.
I hope someone has learned something new when reading this.
EDIT: sorry if I didn't use all the correct namings, I did this from the top of my head... No references.