〜ため(に)
In order to… (purpose) / because of… (cause)machine translation
FormationVerb dictionary form + ために; noun + のために. Cause meaning: plain form + ため(に)
First meaning — PURPOSE: "do B in order to achieve A". The first clause is a dictionary-form verb describing a deliberate action: 日本の会社で働くために、日本語を勉強しています. Both clauses must share the same subject, and the verb before ために must be something you can actively do — this is exactly what distinguishes it from ように (used with non-volitional verbs like 分かる、できる; see the 〜ように lesson).
With nouns, use のために, meaning "for, for the sake of": 家族のために働きます (I work for my family), 健康のために (for my health). The noun here is usually a person, organization, or goal.
Second meaning — CAUSE: "because of A, B", formal, common in station announcements, written language, and news: 事故のため、電車が遅れています (due to an accident, the trains are delayed). How to tell them apart: if the first clause is something that has happened or is happening beyond anyone's control (an accident, a storm, an illness), then ため indicates a reason, not a purpose. In everyday conversation, reasons are still more naturally expressed with から・ので.
Examples
日本の会社で働くために、日本語を勉強しています。
I'm studying Japanese in order to work at a Japanese company.
家族のために、毎日料理を作ります。
I cook every day for my family.
事故のため、電車が遅れています。
Due to an accident, the trains are delayed.