Ubuntu 18.04, Installation of nvidia 430.50 driver failed

My laptop is optimus based notebook. So, I installed nvidia driver 430.50 through ppa.
But, when I typed nvidia-smi, “NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.” showed up.

I followed many things from generix’s advice. But, i still failed. Please help me.
I attached bug report as well.

Also dkms status output is

bbswitch, 0.8: added
bcmwl, 6.30.223.271+bdcom, 4.15.0-65-generic, x86_64: installed
bcmwl, 6.30.223.271+bdcom, 4.15.0-69-generic, x86_64: installed
bcmwl, 6.30.223.271+bdcom, 4.15.0-70-generic, x86_64: installed
nvidia, 430.50: added
rtl8812au, 5.6.4.35369.20191021, 4.15.0-65-generic, x86_64: installed
rtl8812au, 5.6.4.35369.20191021, 4.15.0-69-generic, x86_64: installed
rtl8812au, 5.6.4.35369.20191021, 4.15.0-70-generic, x86_64: installed

uname -r
5.1.16-050116-generic
nvidia-bug-report.log.gz (1.07 MB)

This looks like the header files for the currently running kernel (5.1.16) are missing. All modules have only been built for older kernel versions. Also, 5.1 is discontinued, please either update ubuntu hwe stack to get to the current 5.0, or upgrade to the edge hwe stack to get to 5.3.

Thank you so much generix. So, I updated my kernel to 5.3 version and it works.
So, when I typed the nvidia-smi and nvidia-settings, both of them worked.
But, in nvidia-settings, it cannot detect my second monitor. I wanna use dual monitors with additional dell monitor. But, it did not work.
Can you help me to be able to use dual monitors?
When i see X server Display configuration tap, there is only one PRIME Display(my thinkpad laptop display).

Please create a new nvidia-bug-report.log with the monitor attached.

Yes, I attached this.
Also, when I rebooted this computer, nvidia-settings showed me ERROR: Unable to load info from any available system and nvidia-smi showed No running processes found.
nvidia-bug-report.log.gz (270 KB)

You seem to have installed the nvidia driver using the .run installer. That doesnt work on hybrid notebooks. Please uninstall it using the --uninstall option, then install the repo driver using Ubuntu’s Software&Updates application.
You should then be able to switch to the nvidia driver using
sudo prime-select nvidia

I used Ubuntu’s Softwares&Updates when I installed nvidia driver.
Also, I already did prime-select nvidia.
Is there any other ways to solve this?
I already purge all nvidia things and reinstalled through ppa and software&updates.
This attached file is a bug report when the nvidia-settings worked well
nvidia-bug-report.log.gz (270 KB)

Something is unloading the nvidia driver. Did you recently install any additional software that handles gpu management?

Thanks so much generix. I solved this problem after I changed my gdm3 to lightdm.
But, I always get your help a lot. Thanks very much!