***Neither a teacher nor a native speaker.***
It's okay if you have a bit stress, but it's not okay not to take your time when you write a text.
As you can see there were a lot of mistakes due to "speed-typing".
And please use full words, not things like "asap".
Yes, it is correct to say:
I didn't know you had a brother.
I didn't know he was studying law.
We use this structure to hold the tenses.
In these examples the words "had" and "was" are conjunctives.
Many people think that it's past, but it's not past.
I didn't know you had a brother once.
I didn't know you had a brother in the past.
I didn't know he was studying law once.
I didn't know he was studying law in the past.
Now this would be "real" past.
Some people ignore the rule and just say:
I didn't know you have a brother.
I didn't know he is studying law.
Yes, it may avoid confusion, but don't expect to pass a test...
P.S. I'm sorry I don't know its correct name (what grammar type it is.)
Student or Learner