31:6 Be strong and of a good courage, fear not, nor be afraid of them: for the LORD thy God, he it is that doth go with thee; he will not fail thee, nor forsake thee.
Comment: “Be strong and of a good courage”: Deuteronomy 31 now mentions this kind of encouragement for the first time. This first time, Moses encourages the Israelites to be strong (in plural form).
31:7 And Moses called unto Joshua, and said unto him in the sight of all Israel, Be strong and of a good courage: for thou must go with this people unto the land which the LORD hath sworn unto their fathers to give them; and thou shalt cause them to inherit it.
Comment: “Be strong and of a good courage”: Deuteronomy 31 now mentions this kind of encouragement for the second time. This time, Moses encourages Joshua to be strong (in the singular form).
31:23 And he gave Joshua the son of Nun a charge, and said, Be strong and of a good courage: for thou shalt bring the children of Israel into the land which I sware unto them: and I will be with thee.
(A) “Be strong and of a good courage”: Deuteronomy 31 now mentions this kind of encouragement for the third time. This time, Gd encourages Joshua to be strong (in the singular form).
(B)A similar encouragement was also repeated three times in Joshua 1:1-9. The Hebrew root of “Be strong” is chazaq חזק, which has numerical value 8+7+100=115. When repeated three times, the total value is 3*115=345, which equals to the numerical value of “Moses” משה
(40+300+5=345), and also to the numerical value of “Hashem” השם
(5+300+40=345), which means “The Name” (of the L-RD).
(This approach of assigning letters with numerical values is called “gematria” , see, e.g.,https://www.chabad.org/library/article_cdo/aid/5541252/jewish/Everything-You-Need-to-Know-About-Gematria.htm)
( C) The gematria relations above can allude to the teaching that when the old generation passes the baton, the younger generation (symbolized by Joshua and the Israelites) should be repeatedly encouraged to be strong חזק and courageous, in order to carry out the unfinished assignment. With Gd’s presence (symbolized by The Name השם), they will retain the spiritual strength of the old generation (symbolized by Moses משה here).
See https://www.chabad.org/library/article_cdo/aid/4305074/jewish/Why-Say-Chazak-After-Finishing-a-Book-of-Torah.htm, which also explains a related Jewish custom of saying “Be strong, be strong, and may we be strengthened חזק,חזק, ונתחזק”, upon finishing reading a book of Torah.
(D) I noticed that the phrase “with thee” עמך also appears each time after the encouragement of “be strong”. For the second time, the phrase “with thee” appears in v. 31:8. There were three times when I was worrying about future uncertainties, this verse Deuteronomy 31:8 appears and encourages me: “And the LORD, he it is that doth go before thee; he will be with thee, he will not fail thee, neither forsake thee: fear not, neither be dismayed.” The first time was about 10 years ago, when I was in a very difficult situation, isolated in the mostly atheistic population of China, I unexpectedly saw this sentence written on an artwork in a Christian bookstore (Nissi Bookstore) in Nanjing, and I was greatly encouraged. Soon, I moved to Jinan, where I found several fellowships of believers. The second time was about 7 years ago, when I was not sure about my journey in faith, this verse appeared and encouraged me again, since at that time my daughter was studying this verse in a children’s Bible study program called AWANA. The third time is recently, when I have some health related concerns related to my wife and myself, this verse again appears to encourage me. When you know that Gd will be “with you”עמך, you can be “strong”חזק and courageous.
Some gematria related discussion :
In Hebrew, “with thee” עמך has value 70+40+20=130, the three times of its appearance in this Chapter (Deuteronomy 31:6,8,13) give a value of 3*130=390, which equals to the numerical value of “HaShechinah” השכינה, the shechinah, or “The dwelling”, signifying the presence of Gd. See https://en.wikipedia.org/wiki/Shekhinah
This value 390 is also related to the numerical value of Joshua יהושע
10+5+6+300+70=391, since the difference of 1 can be ignored, according to a bible-related tradition, see https://judaism.stackexchange.com/questions/90033/gematriot-that-differ-by-1
When the shechinah or Gd’s presence (השכינה) is “with thee” (עמך), to lead you whenever you face uncertainty in life, you can be like Joshua (יהושע), who becomes strong and courageous to accept the baton from his predecessor, and finish his mission to occupy the promised land.
(E) This portion is the shortest in the Torah, only 1 chapter with 30 verses. However, it is very important, since it teaches that we should strive to pass our heritage of Bible-related traditions to the new generation.
Interestingly, the first Torah-related essay that my daughter wrote (when she was about 13 years old)  was about this portion and about the three chazaq’s. She chose this portion because this is the shortest portion.
 My daughter’s essay on Parashat Vayelech.