My father passed away few days ago and we are living together. Is there any restriction on having sex with my wife while living in the same house? Someone told me that I need to wait a minimum of 40 days for sex. Is this right?
There is no such prohibition. Instead, there is prohibition on mourning for more than 3 days on the part of women -
We were forbidden to mourn for more than three days except for a husband.
Even then, according to this fatwa source, mourning means avoiding adornments etc. So, abstaining from intimacy with spouse is not a part of it.
However, the prayer of a righteous child benefits a deceased person. [Hadith]
Hence, you can pray for him for as many days as you wish, but not anything that constitutes mourning for more than three days.