～に違いない and ～に相違ない are not necessarily difficult, but there are certain problems that students have. The unusual way it connects to adjective/verb expressions, not properly understanding what can follow them, and not understanding formality differences are the main sources of error. The lesson will be ended with the similar ～に決まっている.
First and foremost, these expressions are both translated as “there is without a doubt that…”. This is the immediate source of confusion because you can add phrases like “I think that” or “probably” in English without causing ungrammaticality. However, with these Japanese expressions, doing so does. First, consider the following defining of these terms.
～に違いない: Not from objective proof or logical speculation, but rather from the speaker’s own experience, this phrase shows one’s intuitive speculation/confidence. With such a bold move, it is without surprise that this is quite strong. It is often used in situations where it's as if one is talking to oneself in attempts to verify one’s own guess or deliberation.
～に相違ない: Like ～に違いない, it shows intuitive speculation/confidence, but it is more stiff and formal. This formality difference is very important to keep in mind. One reason is that speech modals more akin to the spoken language like the final particle から, which is commonly used with ～に違いない, are not typically used with ～相違ない. This also implies that there is no mistake in it; thus, it gives a more confident tone. Thus, although adverbs like きっと are common with ～に違いない, it is not with ～に相違ない due to the tone. Although perhaps of old logic, some speakers feel this is more so indicative of middle-aged/old men as they are more likely to use old-fashioned expressions, which would not be old-fashioned for them, and fits the traditional tone for masculine speech.
These patterns attach to phrases in the following manner.
|形容詞||形容詞 ＋ ～に｛違い・相違｝ない|
|形容動詞||形容詞（である） ＋ ～に｛違い・相違｝ない|
|Verbs||Verb ＋ ～に｛違い・相違｝ない|
Notice that it does not say Adj/V ＋ こと ＋ に｛違い・相違｝ない. It is a set phrase, and like other phrases with に, the reason for why this is allowed stems from a Classical Japanese grammatical maneuver of using conjugational parts of speech as nominal phrases when in the 連体形. As this base has changed appearance for many items, it's not surprising that in Modern Japanese this technique is limited.
Adverb Note: Adverb phrases that commonly get used with ～に違いない include 恐らく, きっと, and 絶対に; adverb phrases that commonly get used with ～に相違ない include 絶対に, 確かに, and ～の通りに.
The response of the government spokesperson was in no doubt overly regrettable.
Grammar Note: In a more literary sense どんなに（か） may be replaced with いかばかりか. Also note that the use of か with this in the first place is hardly ever heard.
That’s right. It's just as you say.
It is without a doubt that this plan's implementation is difficult.
There is no doubt that a robber came in.
Although it's without a doubt that you're an idiot, there's no other way but to take responsibility.
It will definitely be cloudy tomorrow.
There's no doubt that the company president is a genius.
8. 「あの女の人は誰でしょうか」「ケンさんのガールフレンドに違いありません。手を繋いで一緒に歩いていますか ら」
"Who is that woman?" "There's no doubt that she's Ken's girlfriend because they're holding hands walking together".
9. 「あの人は何語の学生でしょうか」「日本語の学生に違いありません。読んでいるものに「新しい」と書いてあり ますから」
"What language student is that person? "That person is no doubt a Japanese student because the thing (that person) is reading has "atarashii" written on it"
"I wonder if that person lived in Japan" There's no doubt about it because he's reading a Japanese newspaper"
"I wonder if that woman is married" "There's no doubt about it because she's wearing a ring"
～に決まっている means "it is certainly..." and follows nouns, adjectives, or verbs. This speech modal shows 100% certainty and is reflective of 話し言葉. It shows that the speaker is very confident in labeling something as so. It is also used in chastising.
He's certainly lying.
It is certainly hot in summer.
(They) will certainly lose.