What makes an argument valid?

I'm currently a month into an Intro to Logic course, and I still can't seem to wrap my head around some cases of valid arguments. I was doing an assignment for the course surrounding validity and soundness of arguments and two questions stood out to me that I didn't quite understand even after answering them correctly Could anyone explain to me the reasons that make these two arguments valid? The first is "2+2=5. Therefore, the moon is made of cheese." and the second is, "The moon is made of cheese. Therefore, 2+2=4." I was reading an earlier post on this subreddit about a similar case and I feel like I almost understood the reasoning, but I am not sure.

The best I could do to explain it to myself is that since 2+2 does not actually =5 then the premise could never be true, meaning that the premise being true and the conclusion being false would never occur. For the second one, I understood it as; since 2+2 always =4 no matter what the premise is, the conclusion will always be true, making it valid.

Am I going about this the right way?