1.
in order to; for (doing)
After a plain verb: the purpose for which something is needed, best or hard. The main clause is an evaluation, such as 必要だ, いい or 大変だ, not an action.
2.
for (someone); (contrastive) in, at, to
に + は after a noun: "for" a person whose judgment or ability is meant (私には難しい), or に (in, at, to) made the topic, often to contrast it with something else.
Related Words
Related:
に (location, direction, time marker)
Related:
は (topic marker)
Compare:
ために (in order to (with actions))