How to simplify an expression through variable substitution?

Hello, I am trying to simplify a complicated expression through variable substitution and part of the expression looks like:

2A_1^2+A_1B_2+2B_1^2-B_2A_1+2C_1^2+C_1D_2+2D_1^2-D_2C_1

I want to substitute A_1^2+B_1^2+C_1^2+D_1^2 with h_1^2 and substitute A_1B_2-B_2A_1+C_1D_2-D_2C_1 with h_{12} and finally the expression would become 2h_1^2+h_{12}.

I have tried to use /. to replace, however, it seems that Mathematica is not able to do the substitution when the expression don’t explicitly contain the part to be substituted.

What’s more, I also tried to use Solve and Reduce method. But as I am new to Mathematica, I cannot get a simple expression from Reduce (the results are divided into several conditions like B1=0&&B2=0) and I cannot get a desired result from Solve.

Could anybody give some examples on how to do this? Thanks in advance!!

Welcome to Wolfram Community!
Please Edit your post and provide your trials in terms of Wolfram Language code. This will make it easier for other members to help you.

Check several methods available to include your code in the rules http://wolfr.am/READ-1ST

Perhaps

Simplify[2A1^2+A1 B2+2B1^2-B2 A1+2C1^2+C1 D2+2D1^2-D2 C1- 
  2(A1^2+B1^2+C1^2+D1^2)+2h1^2-
  (A1 B2-B2 A1+C1 D2-D2 C1)+h12]

which returns

2*h1^2 + h12

but this is perhaps not because of the reason you think because

A1 B2-B2 A1+C1 D2-D2 C1==0

unless you might be thinking and have not told Mathematica that these are noncommutative products

Ah, duplicate
here
with more methods than I provided.