Let
a = 9 hr be the amount of time it takes machine A do the job,
b = 7 hr be the amount of time it takes machine B do the job,
x be the amount of time it takes both machines do the job.
In 1 hour machine A assembles 1/a fraction of the product,
machine B assembles 1/b fraction of the product,
machines A and B together woulkd assemble 1/x fraction of the product.
Also we can say that machines A and B together assemble 1/a + 1/b.
Therefore
1/x = 1/a + 1/b
x = 1/(1/a + 1/b) = a b / (a + b)
Substituting actual numbers:
x = 9 x 7 / (9 + 7) = 3.9 hr