Electric guitars are the iconic instrument of rock'n roll and most of the popular music. Due to the popularization of electronic musical instruments, more and more people interest in how electric guitars work. This study focuses on the physics of the electric guitar and the differences between it and the acoustic guitar. To produce sound and turn the vibrations of the strings into electronic signals, there are magnetic pickups in an electric guitar instead of the hollow resonating cavity found in the acoustic guitar. This study could help students to learn electromagnetism and acoustics more deeply and enjoyably.