Aaron Swartz, the 26-year-old cofounder of Reddit, committed suicide yesterday according to MIT's The Tech.

Swartz' uncle confirmed the news in a comment to The Tech, saying his nephew took his own life in his New York City apartment.

“The tragic and heartbreaking information you received is, regrettably, true,” Swartz’s attorney, Elliot R. Peters of Kecker & Van Nest, confirmed to The Tech in an email.

Swartz's friend and mentor, Cory Doctorow, describes him as someone who was "very involved in freedom issues" with "powerful, deeply felt ideals," but also an "impressionable young man."

Swartz' friends say he had a history of depression, which he wrote about openly on his blog. He was also facing potential jail time for sneaking into MIT and downloading massive amounts of documents from the JSTOR online journal archive.

Aaron Swartz co-founded DemandProgress, an advocacy group. Selfagency via Flickr "Aaron has been depressed about his case/upcoming trial, but we had no idea what he was going through was this painful," his mother wrote this morning on Hacker News. "Aaron was a terrific young man. He contributed a lot to the world in his short life and I regret the loss of all the things he had yet to accomplish. As you can imagine, we all miss him dearly. The grief is unfathomable."

Unfortunately Swartz is not the first startup founder to battle depression. Last year there was a similar gut-wrenching story about Ilya Zhitomirskiy, the 22-year-old co-founder of Diaspora who took his own life.

Swartz made a huge impact on the Internet community. He created one of two startups that combined to form Reddit. Before Reddit, when he was 14, Swartz co-wrote RSS 1.0. He also co-founded an advocacy group called DemandProgress, which encouraged people to take action when news affected them. He did a lot to stop the SOPA and PIPA bills too (see video below).

In September, Swartz wrote one of the final posts on his blog titled Lean Into The Pain. It's an inspiring article about how to deal with both mental and physical hardships. Here's an excerpt:

When you first begin to exercise, it’s somewhat painful. Not wildly painful, like touching a hot stove, but enough that if your only goal was to avoid pain, you certainly would stop doing it. But if you keep exercising… well, it just keeps getting more painful. When you’re done, if you’ve really pushed yourself, you often feel exhausted and sore. And the next morning it’s even worse.

If that was all that happened, you’d probably never do it. It’s not that much fun being sore. Yet we do it anyway — because we know that, in the long run, the pain will make us stronger. Next time we’ll be able to run harder and lift more before the pain starts.

And knowing this makes all the difference. Indeed, we come to see the pain as a sort of pleasure — it feels good to really push yourself, to fight through the pain and make yourself stronger. Feel the burn! It’s fun to wake up sore the next morning, because you know that’s just a sign that you’re getting stronger.

Few people realize it, but psychological pain works the same way. Most people treat psychological pain like the hot stove — if starting to think about something scares them or stresses them out, they quickly stop thinking about it and change the subject.

The problem is that the topics that are most painful also tend to be the topics that are most important for us: they’re the projects we most want to do, the relationships we care most about, the decisions that have the biggest consequences for our future, the most dangerous risks that we run. We’re scared of them because we know the stakes are so high. But if we never think about them, then we can never do anything about them.

Ray Dalio writes:

It is a fundamental law of nature that to evolve one has to push one’s limits, which is painful, in order to gain strength—whether it’s in the form of lifting weights, facing problems head-on, or in any other way. Nature gave us pain as a messaging device to tell us that we are approaching, or that we have exceeded, our limits in some way. At the same time, nature made the process of getting stronger require us to push our limits. Gaining strength is the adaptation process of the body and the mind to encountering one’s limits, which is painful. In other words, both pain and strength typically result from encountering one’s barriers. When we encounter pain, we are at an important juncture in our decision-making process.1

Yes it’s painful, but the trick is to make that mental shift. To realize that the pain isn’t something awful to be postponed and avoided, but a signal that you’re getting stronger — something to savor and enjoy. It’s what makes you better.

Pretty soon, when you start noticing something that causes you psychic pain, you’ll get excited about it, not afraid. Ooh, another chance to get stronger. You’ll seek out things you’re scared of and intentionally confront them, because it’s an easy way to get the great rewards of self-improvement. Dalio suggests thinking of each one as a puzzle, inside of which is embedded a beautiful gem. If you fight through the pain to solve the puzzle, you unlock it and get to keep the gem.

The trick is: when you start feeling that psychological pain coming on, don’t draw back from it and cower — lean into it. Lean into the pain.

For more on Aaron's life and thoughts, here's his blog.