This machine has two final state and .
Here for final state we have two distinct path to calculate regular expression so, it sum of two regular expression for two distinct path and same for also.
Regular expression for :
RE1 = a(a + aa*b)* + b(a + ba*a)*ba*
Regular expression for :
RE2 = b(a + ba*a)* + a(a + aa*b)*aa*
Regular expression for machine:
RE = RE1 + RE2
RE = a(a + aa*b)* + b(a + ba*a)*ba* + b(a + ba*a)* + a(a + aa*b)*aa*
= a(a + aa*b)* (λ + aa*) + b(a + ba*a)* (λ + ba*)
= a(a + aa*b)* + b(a + ba*a)* (λ + ba*) [Therefore, (λ + aa*) = a*]