Doesn't matter if the suing party is a bona fide patent troll or a frivolous suit from a "legitimate" company.
Then why did you ask about defending themselves against patent trolls?
How likely is it that a legitimate company suing them is going to be in their same field and practicing their patents? It's extremely unlikely, that's for sure.
Acquiring a few BS patents is not a defense against patent trolls OR legitimate companies, instead you need MANY generic patents, like IBM or Microsoft has, if you expect to use patents as a defense, AND....
Khan Academy doesn't have that much money to defend itself against patent lawsuits, no matter who they come from.
Non-sequitur. The process of applying and going through the process and obtaining a full-blown patent is expensive, and you say they have little money for defense... that's just inconsistent with them getting a bunch of patents. This is a method of defense against would-be infringement lawsuits that is quite expensive, which could come from any source patent troll or legitimate company in ANY industry, not just your same industry.
Just having a patent provides no defense, if you cannot use it as a basis for suing your litigator.
If you want to make sure someone else doesn't patent your invention, then you just need to create a provisional patent or defensive publication, which doesn't involve many thousands of $$$ in application, research, and legal fees.
The only reason to obtain just a few patents concerning what you are doing is for generating revenue....