The nominalizer の + に (for/to) creates a purpose construction meaning "for the purpose of doing" or "in order to do." Usually paired with 使う・必要だ・役立つ・かかる. Different from concessive のに ('even though').
[Verb dictionary form] + のに (+ 使う/必要だ/役立つ/かかる)
この辞書は日本語を学ぶのに役立ちます。
Kono jisho wa nihongo wo manabu no ni yakudachimasu.
This dictionary is useful for learning Japanese.
学ぶのに (for the purpose of learning) + 役立つ
料理をするのに時間がかかる。
Ryouri wo suru no ni jikan ga kakaru.
Cooking takes time.
するのに時間がかかる = for the act of cooking, time is needed
この鍵はドアを開けるのに使います。
Kono kagi wa doa wo akeru no ni tsukaimasu.
This key is used to open the door.
開けるのに使う = use it for the purpose of opening
• のに (purpose) vs ために (purpose): ために suits volitional verbs and personal goals; のに suits function/use/necessity, especially with inanimate subjects. • Nuance: 勉強するのに役立つ (useful for studying) vs 勉強するために毎日頑張る (work hard in order to study).
The JLPT rarely asks whether you recognise a pattern — it asks which of several similar patterns fits. These are the ones のに is tested against.
ために is for volitional goals and people ('in order to'); のに suits function/necessity, typically with 使う・役立つ・かかる and inanimate subjects.
Same sound, different grammar: concessive のに means 'even though' after a plain clause; here の (nominalizer) + に marks purpose after a dictionary-form verb.
Study Japanese grammar on LenGaki

Get the Android app
The app adds offline study, home-screen widgets, stroke-order tracing, speaking practice with pronunciation scoring, and an AI tutor that answers questions in context — none of which fits in a browser tab.