Just to add to the answers given, I would like to give a slightly different way to arrive at the same conclusion. My background is in mathematics, and so my answer might seem amateurish from a philosopher's or logician's perspective.
I'll start with sufficiency, since it is easier. This answer is the same as those given. If
p is sufficient for
p is enough to have
q. That is, if we have
p, we have
p ⇒ q.
The statement "
p is necessary for
q," means, we must have
p to get
q. In other words, if we don't have
p, then we can't have
q. In symbols,
~p ⇒ ~q,
where I use
~ to denote negation. The logical equivalent, called the contrapositive, of this is
q ⇒ p.
Necessity and Sufficiency
p is necessary and sufficient for
p ⇔ q.
Another way this is commonly written is
p if and only if q.
It is sometimes abbreviated as
p iff q.
Example of confusing a claim with its converse
Consider the claim "All dogs go to heaven." This means
you are a dog ⇒ you go to heaven.
That is, being a dog is sufficient for entrance to heaven. The necessity statement, its converse, is this:
you go to heaven ⇒ you are a dog.
It's possible that you might be a cat in heaven, and so this is not true. The only way this could be true is if there is a law that requires all dogs and only dogs to enter heaven. That is, being a dog is necessary to enter heaven.
This is also sometimes called confusing cause and effect. There is more explanation and examples on this website: