Question
Find a Regular Expression to describe the following language: {b, a, abc, ab, a 2 bc 2 , ab 2 , ..., a n bc
Find a Regular Expression to describe the following language: {b, a, abc, ab, a2bc2, ab2, ..., anbcn, abn, ...}
I am studying for a discrete math class, and we are currently learning about Regular Languages, Regular Expressions, and Finite Automata.
I am stuck on this problem because I don't know how to get the same number of "a" and "c" with a "b" in between, in the expression anbcn. At first, I was thinking the expression a*bc* would match, but I think since they are both raised to "n," this means they have to have the same number of a's and c's, which I can't find a way of doing.
A friend of mine who had the class a year ago said this might actually be a trick question, and that this is meant to showcase a limitation of the regular expressions, but he also said that he wasn't sure since it has been a long time since he took the class.
Please explain how you came up with the Regular Expression that matches this language, or if there is not one, please explain why. I would like to gain a deeper understanding of Regular Expressions, and be able to do more problems similar to this in the future. Thanks!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started