Why/How can ghosts make noise on floorboards when “walking”

I have 2 encounters with ghost/spirit

1.) - I was sleeping in the bedroom with my wife and I awoke to the floorboards creaking (when somebody walks) I looked up and I saw a figure standing by the door (too dark to make out any details) I thought it was our son so I told him to go to his mom. No response. Said it a 2nd time. No response. The figure then walks to the foot of the bed and that’s when I knew it wasn’t my son. I cowardly put the blankets over my eyes and screamed. Wife woke up. Nobody there. Son in his room. We have 2 dog gates on each of our doors so it wasn’t him.

2.) Just happened an hour ago 5:30AM. Heard somebody coming down the stairs (i slept on the couch) Thought it was the wife nagging about the pillows on the floor, so I faked like I was sleeping. Heard them stop at the front of the couch for about 15 seconds then walk back upstairs (could hear it) But there was no door opening sound to go back into the bedroom (our doors creak loudly even when you try to open gently) my wife or son didn’t come down.

I’m curious about the science behind a ghost making noise on the floors when walking. Wouldn’t that defeat the logic of a ghost/spirit?