"Yet the Lord longs to be gracious to you; therefore he will rise up to show you compassion. For the Lord is a God of justice. Blessed are all who wait for him!" (Isa 30:18) "Return, you Israelites, to the One you have so greatly revolted against" (Isa 31:6, NIV).
Theme: Though we stubbornly and proudly insist on relying on our own plans instead of trusting God, yet God still longs to be gracious to us. This is the amazing logic of grace.
Isaiah 30 and 31 are connected because they both begin by denouncing the alliance with Egypt in the most explicit terms (Isa 30:1-5; 31:1-3).