I am trying to understand how to define the exponential function $a^x$ for any $a>0$ and any $x\in\mathbb{R}$ I know the basic definition of the exponential function for natural numbers, which is $a^n=a⋅a⋅…⋅a $(n times). I also know how to extend this definition to rational numbers by using the fact that $a^{\frac{n}{m}}= \sqrt[m]{a^n }$, where $m$⋅ denotes the $m$-th root also I know the definition of the negative power of rational numbers . But I am curious how to define the function for all real numbers, not just rational ones. obviously we will define $f(x+y) =f(x) f(y)$ for all real numbers $x,y$ but here I have no Idea how to extended to all Real numbers. I have heard that there are some ways to do this using limits, continuity, but I needed this so I can prove that $a^x$ is continuous function so I am confused of how to use calculus to make the definition of $a^x$ by using $e^x$ as continuous function and that would make me ask why is $e^x$ continuous in the first place one can show that $e^x$ is continuous at $ \mathbb{R}$ if it is continuous at zero but how we will establish that if we didn't define it at irrationals?
. Could someone please explain to me the general definition of an exponential function and why it works?
As has been pointed out in the comments, one definition of exponentiation comes through defining $a^r:=\exp(r\ln(a))$, where the exponential and natural log are already defined and shown to be continuous through other means.
However, perhaps a more intuitive approach comes from showing the usual definition for rational exponents has a unique continuous extension to the reals.
To see this, let's suppose $a>1$, as we can deal with $a<1$ in a similar manner (or we can define $a^r=(\frac{1}{a})^{-r}$ when $a\in (0,1)$.)
Note that $f\colon \mathbb Q \to \mathbb R$ given by $f(q)=a^q$ is certainly increasing in $q$, since if $q_1<q_2$, then for some $n\in\mathbb N$, $nq_1<nq_2$ are integers, and then we have $a^{nq_1}< a^{nq_2}$, and taking $n$-th roots gives us $a^{q_1}<a^{q_2}$.
Moreover, we can see $f$ is continuous at $0$. Since it is increasing, it is enough to show $\sup_{q<0} a^q=\inf_{q>0}a^q = 1$. This holds, since if the second equation fails, then we have some $\eta>1$ with $a^{\frac{1}{n}}\geq\eta$ for each $n\in\mathbb N$, whereby $a\geq\eta^n$ for all $n$, contradicting $\lim \eta^n=\infty$ for $\eta>1$, and you get a similar contradiction if the supremum fails to equal $1$.
Next, we argue that $f$ is uniformly continuous on bounded sets. To see this, note that by continuity at $0$, for each $\epsilon>0$, we have a $\delta>0$ for which $$|q|<\delta\implies |a^q-1|<\epsilon\text{.}$$
Then if $q_1<q_2$ are in $[-M,M]$, and $q_2-q_1<\delta$, we have $$|a^{q_2}-a^{q_1}|= a^{q_1}|a^{q_2-q_i}-1|\leq a^{q_1}\epsilon\leq a^M\epsilon.$$ Thus given $\epsilon_0>0$, we may let $\epsilon=\frac{\epsilon_0}{a^M}$, and choose the $\delta$ corresponding to $\epsilon$.
Since $f$ is uniformly continuous on bounded sets, and $\mathbb Q$ is dense, there is a unique continuous extension $\bar{f}$ to $\mathbb R$, and so we may define $a^r=\bar{f}(r)$.
Remark
From monotonicity, continuity and density of $\mathbb Q$ we have $a^r=\sup_{q<r} a^q =\inf_{q>r} a^q$, where the supremum and infimum are taken over rationals. We could also have started from one of these as a definition, and then established continuity through monotonicity, and showing the supremum and infimum coincide.