Hi,
The laptop might have overheated that's why it shuts down by itself. Please do try some of these troubleshooting steps that may help.
- First unplug the laptop from it's charger and let it rest for an hour then test it if it will boot up after.
- Do another test your AC adapter if it's supplying enough voltage to power the laptop or better yet try another AC adapter that has the same voltage.
-Next is to reseat the RAM, remove them all for couple of seconds then put them back in making sure that they are all seated properly.
- If you hear the laptop turning on and the fans spinning try and connect an external monitor and see if you'll get any display from it.
- If all these will not work the problem lies in the motherboard of your laptop.