Our righteousness is not based on OUR faith, but the faith OF Jesus. And the only way to be “justified” (declared righteous) is to be a recipient of the “faith OF Jesus”.
“...the righteousness of God is through the faith of Jesus Christ to all. and on all who believe." (Romans 3:22)
If your version of the Bible says "faith IN Jesus", it is wrong. Any honest translator with a Greek Interlinear will clearly see the proper translation is "faith OF Jesus". Nothing wrong with having faith IN Jesus, but that is not the context in the above verses which are talking about the faith that Jesus had, not our faith.
For it is by Grace you have been saved, through FAITH - and that NOT OF YOURSELVES, it is the GIFT OF GOD...we have fixed our hope on the living God, who is the Savior of all humanity...Fixing our eyes on Jesus, the author and perfecter of FAITH, who for the joy set before Him endured the cross, despising the shame, and has sat down at the right hand of the throne of God.” (Ephesians 2:8; 1 Timothy 4:10; Hebrews 12:2-3)
Jesus had faith that His suffering and death on the Cross was the RIGHT thing for God to do in order to save humanity. The sacrifice of His body was necessary to do so, and therefore Jesus "endured the cross" because He knew that...
"Sacrifice and offering you did not desire, but a body you prepared for me; with burnt offerings and sin offerings you were not pleased. Then I said, Here I am—it is written about me in the scroll - I have come to do your will, my God....and by that will, we have been made holy through the sacrifice of the body of Jesus Christ once FOR ALL...when this priest had offered FOR ALL TIME one sacrifice for sins, He sat down at the right hand of God, and since that time He waits for His enemies to be made His footstool. For by one sacrifice He has made perfect forever those who are being made holy..." and God says that "their sins and their lawless deeds I will remember no more." (Hebrews 10:5-17)
What is the will of God for humanity that Jesus was sent to do?
"This is good and acceptable in the sight of God our Savior, who WILLS all humanity to be saved and to come to the knowledge of the truth. For there is one God, and one mediator also between God and humans, the man Christ Jesus, who gave Himself as a ransom FOR ALL..." (1 Timothy 2:3-7)
"Therefore when Christ came into the world He said 'Sacrifice and offering You did not desire, but a body You prepared for Me. In burnt offerings and sin offerings You took no delight. Then I said, ‘Here I am, it is written about Me in the scroll: I have come to do YOUR WILL, O God.’ ” (Hebrews 10:5-7)