In logic, the words necessary and sufficient describe relations that hold between propositions or states of affairs, if one is conditional on the other. For example, one may say:
- Drinking water regularly is necessary for a human to stay alive.
- Jumping is sufficient for leaving the ground.
- Having an ID card is a necessary and sufficient condition for being allowed in.
Note: This article discusses only the logical relationships implied by necessary and sufficient. The causal meanings of these words are ignored. This is potentially misleading, since the words often imply causation in normal usage.
To say that A is necessary for B is to say that B cannot be true unless A is true, or that whenever (wherever, etc.) B is true, so is A. We might say that being at least sixteen years old is necessary for having a driver's license.
In the sense in which we are using the word "necessary" here, we might also say "smoke is necessary for fire." This is confusing, since smoke comes after fire; but all we are saying is that wherever B is, there is A - ie, fire (A) cannot occur without there being smoke (B). We are trying not to say anything about the direction of time at all. Ordinary language would say "smoke is a necessary outcome of fire." 
In either case, the important thing is to note that one thing is assumed (fire, a license), and a second thing is derived as "necessarily following." Being sixteen is the necessary condition in the first case; smoke is the necessary condition in the second (though, again, we ordinarily would not call it a "condition").
Importantly, it is quite possible for a necessary condition to occur on its own. So, you can be sixteen without having a driver's license, and there are ways to generate smoke without fire.
If A is a necessary condition for B, then the logical relation between them is expressed as "If B then A" or "B only if A" or "B → A" (B implies A).
To say that A is sufficient for B is to say precisely the converse: that A cannot occur without B, or whenever A occurs, B occurs. That there is a fire is sufficient for there being smoke.
Necessary and sufficient conditions are therefore related. A is a necessary condition for B just in case B is a sufficient condition for A.
In the sense in which we are using the word "sufficient", we might also say "Having a license is sufficient for being sixteen." This is confusing, since having a license doesn't cause you to be sixteen; still, the ordinary sense of it is that if you have a license, you must be sixteen (we consider licenses proof of age because we consider them sufficient for age in something like this sense). Try to ignore the causal relationship and the direction of time: we are looking at it just as a logical relationship.
In either case, note that one thing is assumed (fire, a license), and this same thing we are identifying as the sufficient condition for another thing (smoke, age) - sufficient in the sense of "enough for the other to be the case".
Importantly, a sufficient condition, by definition, is what cannot occur without the thing it is a condition for. So, you cannot have a license without being sixteen.
If A is a sufficient condition for B, then the logical relation between them is expressed as "If A then B" or "B only if A" or "A → B".
Necessary and sufficient conditions
To say that A is necessary and sufficient for B is to say two things:
- A is necessary for B
- A is sufficient for B.
For example, if Alice always eats steak on Monday, but never on any other day, we might say "Being Monday is a necessary and sufficient condition for Alice eating steak." The converse is also true: "Alice eating steak is a necessary and sufficient condition for it being Monday". Thus, whenever A is necessary and sufficient for B, B is necessary and sufficient for A.
Once again, this is confusing, since Alice's act of eating steak doesn't cause it to be Monday.
Since the phrase "necessary and sufficient" can express a relation between sentences or between states of affairs, objects, or events, it should not be too quickly conflated with logical equivalence. Alice eating steak is not logically equivalent to it being Monday.
However, "A is necessary and sufficient for B" does express the same thing as "A if and only if B".
- For the purposes of this example, we're ignoring the possibility of fire that doesn't create smoke.