What is the difference between necessary and sufficient conditions? 
*

*If $p\implies q$ ("$p$ implies $q$"), then $p$ is a sufficient condition for $q$.

*If $\lnot p\implies \lnot q$ ("not $p$ implies not $q$"), then $p$ is a necessary condition for $q$.
I don't understand what sufficient and necessary mean in this case. How do you know which one is necessary and which one is sufficient?
 A: Suppose first that $p$ implies $q$. Then knowing that $p$ is true is sufficient (i.e., enough evidence) for you to conclude that $q$ is true. It’s possible that $q$ could be true even if $p$ weren’t, but having $p$ true ensures that $q$ is also true.
Now suppose that $\text{not-}p$ implies $\text{not-}q$. If you know that $p$ is false, i.e., that $\text{not-}p$ is true, then you know that $\text{not-}q$ is true, i.e., that $q$ is false. Thus, in order for $q$ to be true, $p$ must be true: without that, you automatically get that $q$ is false. In other words, in order for $q$ to be true, it’s necessary that $p$ be true; you can’t have $q$ true while $p$ is false.
A: I always think of it in terms of sets.

In the picture above, for an element to be purple, it's necessary to be red, but it is not sufficient.
The same holds for the blue set, to be in the blue set is a necessary condition in order to be purple, but it is not enough, it's not sufficient.
A sufficient condition is stronger than a necessary condition. If you tell me that you have a red or blue element I can't say for sure if it is in the purple set, but if you tell me that you have a purple element I now for sure that it is in the red and blue sets.
A: It has always been difficult for me to connect the linguistic sense of the terms "necessary" and "sufficient" with mathematics.  However, with practice with the following table, this skill becomes automatic.

I'm assuming you understand the meaning of the implication.  In any case it is helpfull to think about simple example when looking at this table. For example: "If it is raining, then close the window". Then it remains to understand the following.
P is a sufficient for Q. If P is true then Q will be always true (the first line in the table). Note that we do not consider the second line. But as we see in the table Q can be true also when P is false (the third line in the table). So P is "just" a sufficient condition for Q.
Q is a necessary condition for P. It is obvious from the table. P can be true "only" when Q is true (the first line in the table). Note that we do not consider the second line.
About $\lnot A \implies \lnot B$. It is called the contrapositive of the statement $A\implies B$. As you see it is not necessary for you for understanding the "sufficiency" and "necessaty".
