First and foremost, as others have posted the information upthread, if you are having these sorts of ideas, please, please, call them or someone you know and trust and get help.
Speaking for myself, I know that the times I’ve been in my darkest places, when my mind wanders into the area that I might be spared my pain in death, the moment the thought crosses my mind of hurting myself, the idea that it would cause more pain for others made it an immediate impossibility. I’m simply utterly incapable of causing harm to others, particularly that severe, and would rather suffer myself. I can understand how that might be possible to bypass that sort of thought process if the pain were sudden and the impulse strikes without the full thought out and not something fantasized or planned over time, but then again, impulsive is about the last word anyone would ever use to describe me.
So, that one would be considering whether it’s best to kill oneself so loved ones are aware or not to cause them the least amount of pain, it seems to me that one would also know that the only way to cause them the least pain is to, rather than put that effort into planning the suicide so as to spare them, but rather to avoid suicide altogether. One thing I’ve learned from managing my own depression is generally that, not only am I in need of support when those sorts of ideas cross my mind, particularly in the concern that if I do reach that point, even if I’m not impulsive, there is that chance it will come up, but in fact, I usually know far enough before I reach that point that I can either seek help from loved ones or find some other means of soothing myself to avoid getting there. Of course, I don’t always succeed, but it does mean that people around me are aware more aware.
Either way, I guess my point is, you’re asking the wrong question. It’s not whether disappearing or making sure they know causes the least pain, but how you can love them the most by causing them the least pain. Finally, again, if these are thoughts you are having, please, please, seek help now.