problem might need to be a bit better defined, since you said “rectangles” instead of “squares”, then it’ll be straightforward to answer.
so, larger rectangle’s total area should become sum of smaller+larger rectangles’ areas, correct?
old_large_area = large.width * large.height
old_small_area = small.width * small.height
new_large_ area = old_large_area + old_small_area
that’s the easy part, but you still have some sort of unspecified constraint left to deal with before you can convert that new area into the new width/height of the large rect… (if they were squares then it’d just be a sqrt())
what “shape” must the larger rectangle maintain? preserve large rect’s original aspect ratio? some weighted-by-area percentage (lerp) toward the aspect ratio of the smaller rect? or straight average of the two? or???