rem vs em

This text is HTML root font (20px)
This text is parent font (20px)
This text is 2rem

Below is a parent

Root font-size: 10px Parent font-size: 20px
Child font-size: 2em (40px)

Below is a parent

Root font-size: 10px Parent font-size: 20px
Child font-size: 2rem (20px) why smaller???