Reset iPhone 3GS with broken power button and touch screen
This happened to me too.  My son forgot his password, and he didn't want his iPhone anymore, but I wanted to erase the device before selling/recycling it.

The broken power button (also called the "sleep/wake" button) makes this difficult - normally you'd hold down the power &amp; home buttons simultaneously while connected to iTunes via USB, all the way through a power cycle, through the apple logo's appearance, until it shows you the Recovery Mode screen as shown here: https://support.apple.com/en-us/HT201412

Without a working power button, a variation is necessary.  What I did was use the Assistive Touch feature, which my son had already turned on months before, since the power button wasn't working.  Plug the device into a computer with iTunes loaded.  Hold down the "Lock Screen" button (in the "Device" submenu) for a few seconds until the power-off slider is shown.  Then, while holding down the Home button, slide the power-off slider to the right - keep holding the Home button for a long time, through the device powering off, through the Apple logo, and until the Recovery Mode screen appears.

Now follow the prompts in iTunes on the computer, and the device should reset as normal.