Metro:
Opera (L2, L5, and Ramal) is the simplest stop for both cathedral and palace.
Bus to the cathedral: 3, 31, 50, 65, and 148; bus to the museum entrance: 3, 148, M3, and N16.
On foot, you are directly opposite
Royal Palace of Madrid and about 5 minutes from
Teatro Real.