Excess axioms in the definition of a metric












5














First, I am aware of how to show the following, my question concerns the reasoning of the standard metric definition.



Traditionally, the axioms defining a metric $rho:Xtimes X rightarrow mathbb{R}$ where $X$ is a nonempty set, are given as:




  1. $forall x, yin X, rho(x, y) = 0 Rightarrow x = y$,


  2. $forall x, yin X, rho(x, y) = rho(y, x)$,


  3. $forall x, y, zin X, rho(x, y)leq rho(z, x) + rho(z, y)$,


  4. $forall x, yin X, 0 leq rho(x, y)$.



It is easy to see that axiom 4 follows from axioms 1 and 3. It is also fairly trivial to show that axiom 2 follows from axioms 1 and 3. It then seems logical to only require the two axioms




  1. $forall x, yin X, rho(x, y) = 0 Rightarrow x = y$,


  2. $forall x, y, zin X, rho(x, y)leq rho(z, x) + rho(z, y)$,



as a definition for a metric. Is there a good reason that this is not the case, besides historical continuity?



Edit: Thanks to Paul Frost for mentioning my original definition was for pseudometrics... The question has been updated.



Edit 2: As commenters have asked for a proof:



Axioms 1, 3 imply axiom 2: First, consider the triangle inequality for general $x, y, zin X$. Then, $$rho(x, y) leq rho(z, x) + rho(z, y),$$ next, set $z = y$ to obtain $$rho(x, y) leq rho(y, x) + rho(y, y)Rightarrow rho(x, y) leq rho(y, x)$$ by axiom 1. Similarly, $$rho(y, x) leq rho(z, y) + rho(z, x),$$ and setting $z=x$ yields $$rho(y, x) leq rho(x, y) + rho(x, x)Rightarrow rho(y, x) leq rho(x, y)$$ so $rho(x, y) = rho(y, x)$.



We may then show Axioms 1, 2, and 3 imply 4. See this answer. It may be somewhat incorrect to say axioms 1 and 3 imply 4, but I don't see this as a problem, as 1 and 3 imply 2, and 1, 2, 3 imply 4. If I'm incorrect in that assumption, please let me know.










share|cite|improve this question









New contributor




hoverless is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    You consider pseudometrics because you do not require $rho(x,y) = 0 Rightarrow x = y$.
    – Paul Frost
    58 mins ago










  • You're right, let me edit that requirement. My mistake!
    – hoverless
    55 mins ago






  • 1




    You say that it is "easy" to see that axiom 4 follows from axioms 1 and 3. Perhaps you would like to share your proof.
    – Xander Henderson
    51 mins ago










  • Your statement Is not quite the usual triangle inequality, which is $forall x, y, zin X.rho(x, y) le rho(x, z) + rho(z, y)$. Whether that affects your proof that symmetry follows from other axioms is unclear, because you haven't given that proof. Please give the proof.
    – Rob Arthan
    50 mins ago








  • 2




    There are even very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generalyl make the axiomatisation harder to understand and harder to generalise.
    – Rob Arthan
    35 mins ago


















5














First, I am aware of how to show the following, my question concerns the reasoning of the standard metric definition.



Traditionally, the axioms defining a metric $rho:Xtimes X rightarrow mathbb{R}$ where $X$ is a nonempty set, are given as:




  1. $forall x, yin X, rho(x, y) = 0 Rightarrow x = y$,


  2. $forall x, yin X, rho(x, y) = rho(y, x)$,


  3. $forall x, y, zin X, rho(x, y)leq rho(z, x) + rho(z, y)$,


  4. $forall x, yin X, 0 leq rho(x, y)$.



It is easy to see that axiom 4 follows from axioms 1 and 3. It is also fairly trivial to show that axiom 2 follows from axioms 1 and 3. It then seems logical to only require the two axioms




  1. $forall x, yin X, rho(x, y) = 0 Rightarrow x = y$,


  2. $forall x, y, zin X, rho(x, y)leq rho(z, x) + rho(z, y)$,



as a definition for a metric. Is there a good reason that this is not the case, besides historical continuity?



Edit: Thanks to Paul Frost for mentioning my original definition was for pseudometrics... The question has been updated.



Edit 2: As commenters have asked for a proof:



Axioms 1, 3 imply axiom 2: First, consider the triangle inequality for general $x, y, zin X$. Then, $$rho(x, y) leq rho(z, x) + rho(z, y),$$ next, set $z = y$ to obtain $$rho(x, y) leq rho(y, x) + rho(y, y)Rightarrow rho(x, y) leq rho(y, x)$$ by axiom 1. Similarly, $$rho(y, x) leq rho(z, y) + rho(z, x),$$ and setting $z=x$ yields $$rho(y, x) leq rho(x, y) + rho(x, x)Rightarrow rho(y, x) leq rho(x, y)$$ so $rho(x, y) = rho(y, x)$.



We may then show Axioms 1, 2, and 3 imply 4. See this answer. It may be somewhat incorrect to say axioms 1 and 3 imply 4, but I don't see this as a problem, as 1 and 3 imply 2, and 1, 2, 3 imply 4. If I'm incorrect in that assumption, please let me know.










share|cite|improve this question









New contributor




hoverless is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    You consider pseudometrics because you do not require $rho(x,y) = 0 Rightarrow x = y$.
    – Paul Frost
    58 mins ago










  • You're right, let me edit that requirement. My mistake!
    – hoverless
    55 mins ago






  • 1




    You say that it is "easy" to see that axiom 4 follows from axioms 1 and 3. Perhaps you would like to share your proof.
    – Xander Henderson
    51 mins ago










  • Your statement Is not quite the usual triangle inequality, which is $forall x, y, zin X.rho(x, y) le rho(x, z) + rho(z, y)$. Whether that affects your proof that symmetry follows from other axioms is unclear, because you haven't given that proof. Please give the proof.
    – Rob Arthan
    50 mins ago








  • 2




    There are even very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generalyl make the axiomatisation harder to understand and harder to generalise.
    – Rob Arthan
    35 mins ago
















5












5








5


1





First, I am aware of how to show the following, my question concerns the reasoning of the standard metric definition.



Traditionally, the axioms defining a metric $rho:Xtimes X rightarrow mathbb{R}$ where $X$ is a nonempty set, are given as:




  1. $forall x, yin X, rho(x, y) = 0 Rightarrow x = y$,


  2. $forall x, yin X, rho(x, y) = rho(y, x)$,


  3. $forall x, y, zin X, rho(x, y)leq rho(z, x) + rho(z, y)$,


  4. $forall x, yin X, 0 leq rho(x, y)$.



It is easy to see that axiom 4 follows from axioms 1 and 3. It is also fairly trivial to show that axiom 2 follows from axioms 1 and 3. It then seems logical to only require the two axioms




  1. $forall x, yin X, rho(x, y) = 0 Rightarrow x = y$,


  2. $forall x, y, zin X, rho(x, y)leq rho(z, x) + rho(z, y)$,



as a definition for a metric. Is there a good reason that this is not the case, besides historical continuity?



Edit: Thanks to Paul Frost for mentioning my original definition was for pseudometrics... The question has been updated.



Edit 2: As commenters have asked for a proof:



Axioms 1, 3 imply axiom 2: First, consider the triangle inequality for general $x, y, zin X$. Then, $$rho(x, y) leq rho(z, x) + rho(z, y),$$ next, set $z = y$ to obtain $$rho(x, y) leq rho(y, x) + rho(y, y)Rightarrow rho(x, y) leq rho(y, x)$$ by axiom 1. Similarly, $$rho(y, x) leq rho(z, y) + rho(z, x),$$ and setting $z=x$ yields $$rho(y, x) leq rho(x, y) + rho(x, x)Rightarrow rho(y, x) leq rho(x, y)$$ so $rho(x, y) = rho(y, x)$.



We may then show Axioms 1, 2, and 3 imply 4. See this answer. It may be somewhat incorrect to say axioms 1 and 3 imply 4, but I don't see this as a problem, as 1 and 3 imply 2, and 1, 2, 3 imply 4. If I'm incorrect in that assumption, please let me know.










share|cite|improve this question









New contributor




hoverless is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











First, I am aware of how to show the following, my question concerns the reasoning of the standard metric definition.



Traditionally, the axioms defining a metric $rho:Xtimes X rightarrow mathbb{R}$ where $X$ is a nonempty set, are given as:




  1. $forall x, yin X, rho(x, y) = 0 Rightarrow x = y$,


  2. $forall x, yin X, rho(x, y) = rho(y, x)$,


  3. $forall x, y, zin X, rho(x, y)leq rho(z, x) + rho(z, y)$,


  4. $forall x, yin X, 0 leq rho(x, y)$.



It is easy to see that axiom 4 follows from axioms 1 and 3. It is also fairly trivial to show that axiom 2 follows from axioms 1 and 3. It then seems logical to only require the two axioms




  1. $forall x, yin X, rho(x, y) = 0 Rightarrow x = y$,


  2. $forall x, y, zin X, rho(x, y)leq rho(z, x) + rho(z, y)$,



as a definition for a metric. Is there a good reason that this is not the case, besides historical continuity?



Edit: Thanks to Paul Frost for mentioning my original definition was for pseudometrics... The question has been updated.



Edit 2: As commenters have asked for a proof:



Axioms 1, 3 imply axiom 2: First, consider the triangle inequality for general $x, y, zin X$. Then, $$rho(x, y) leq rho(z, x) + rho(z, y),$$ next, set $z = y$ to obtain $$rho(x, y) leq rho(y, x) + rho(y, y)Rightarrow rho(x, y) leq rho(y, x)$$ by axiom 1. Similarly, $$rho(y, x) leq rho(z, y) + rho(z, x),$$ and setting $z=x$ yields $$rho(y, x) leq rho(x, y) + rho(x, x)Rightarrow rho(y, x) leq rho(x, y)$$ so $rho(x, y) = rho(y, x)$.



We may then show Axioms 1, 2, and 3 imply 4. See this answer. It may be somewhat incorrect to say axioms 1 and 3 imply 4, but I don't see this as a problem, as 1 and 3 imply 2, and 1, 2, 3 imply 4. If I'm incorrect in that assumption, please let me know.







metric-spaces definition axioms






share|cite|improve this question









New contributor




hoverless is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|cite|improve this question









New contributor




hoverless is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|cite|improve this question




share|cite|improve this question








edited 38 mins ago





















New contributor




hoverless is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









hoverless

284




284




New contributor




hoverless is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





hoverless is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






hoverless is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    You consider pseudometrics because you do not require $rho(x,y) = 0 Rightarrow x = y$.
    – Paul Frost
    58 mins ago










  • You're right, let me edit that requirement. My mistake!
    – hoverless
    55 mins ago






  • 1




    You say that it is "easy" to see that axiom 4 follows from axioms 1 and 3. Perhaps you would like to share your proof.
    – Xander Henderson
    51 mins ago










  • Your statement Is not quite the usual triangle inequality, which is $forall x, y, zin X.rho(x, y) le rho(x, z) + rho(z, y)$. Whether that affects your proof that symmetry follows from other axioms is unclear, because you haven't given that proof. Please give the proof.
    – Rob Arthan
    50 mins ago








  • 2




    There are even very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generalyl make the axiomatisation harder to understand and harder to generalise.
    – Rob Arthan
    35 mins ago
















  • 1




    You consider pseudometrics because you do not require $rho(x,y) = 0 Rightarrow x = y$.
    – Paul Frost
    58 mins ago










  • You're right, let me edit that requirement. My mistake!
    – hoverless
    55 mins ago






  • 1




    You say that it is "easy" to see that axiom 4 follows from axioms 1 and 3. Perhaps you would like to share your proof.
    – Xander Henderson
    51 mins ago










  • Your statement Is not quite the usual triangle inequality, which is $forall x, y, zin X.rho(x, y) le rho(x, z) + rho(z, y)$. Whether that affects your proof that symmetry follows from other axioms is unclear, because you haven't given that proof. Please give the proof.
    – Rob Arthan
    50 mins ago








  • 2




    There are even very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generalyl make the axiomatisation harder to understand and harder to generalise.
    – Rob Arthan
    35 mins ago










1




1




You consider pseudometrics because you do not require $rho(x,y) = 0 Rightarrow x = y$.
– Paul Frost
58 mins ago




You consider pseudometrics because you do not require $rho(x,y) = 0 Rightarrow x = y$.
– Paul Frost
58 mins ago












You're right, let me edit that requirement. My mistake!
– hoverless
55 mins ago




You're right, let me edit that requirement. My mistake!
– hoverless
55 mins ago




1




1




You say that it is "easy" to see that axiom 4 follows from axioms 1 and 3. Perhaps you would like to share your proof.
– Xander Henderson
51 mins ago




You say that it is "easy" to see that axiom 4 follows from axioms 1 and 3. Perhaps you would like to share your proof.
– Xander Henderson
51 mins ago












Your statement Is not quite the usual triangle inequality, which is $forall x, y, zin X.rho(x, y) le rho(x, z) + rho(z, y)$. Whether that affects your proof that symmetry follows from other axioms is unclear, because you haven't given that proof. Please give the proof.
– Rob Arthan
50 mins ago






Your statement Is not quite the usual triangle inequality, which is $forall x, y, zin X.rho(x, y) le rho(x, z) + rho(z, y)$. Whether that affects your proof that symmetry follows from other axioms is unclear, because you haven't given that proof. Please give the proof.
– Rob Arthan
50 mins ago






2




2




There are even very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generalyl make the axiomatisation harder to understand and harder to generalise.
– Rob Arthan
35 mins ago






There are even very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generalyl make the axiomatisation harder to understand and harder to generalise.
– Rob Arthan
35 mins ago












1 Answer
1






active

oldest

votes


















4














There are very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. See Lee Mosher's comment for much more interesting examples.



The answer to your question necessarily involves a matter of mathematical opinion. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generally make the axiomatisation harder to understand and harder to generalise.






share|cite|improve this answer























    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "69"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    hoverless is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3050591%2fexcess-axioms-in-the-definition-of-a-metric%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    There are very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. See Lee Mosher's comment for much more interesting examples.



    The answer to your question necessarily involves a matter of mathematical opinion. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generally make the axiomatisation harder to understand and harder to generalise.






    share|cite|improve this answer




























      4














      There are very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. See Lee Mosher's comment for much more interesting examples.



      The answer to your question necessarily involves a matter of mathematical opinion. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generally make the axiomatisation harder to understand and harder to generalise.






      share|cite|improve this answer


























        4












        4








        4






        There are very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. See Lee Mosher's comment for much more interesting examples.



        The answer to your question necessarily involves a matter of mathematical opinion. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generally make the axiomatisation harder to understand and harder to generalise.






        share|cite|improve this answer














        There are very simple examples of asymmetric metrics: e.g., what you might call the morning rush-hour metric between a city $A$ and a suburb $B$ with $d(A, B) < d(B, A)$ and $d(A, A) = d(B, B) = 0$. See Lee Mosher's comment for much more interesting examples.



        The answer to your question necessarily involves a matter of mathematical opinion. The usual axioms for metric spaces clearly separate several concerns. As often happens with axiomatisations, you can find an axiomatisation with fewer axioms or operators by making some clever changes (e.g., axiomatising a group in terms of the operation $(x, y) mapsto xy^{-1}$) but this will generally make the axiomatisation harder to understand and harder to generalise.







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited 16 mins ago

























        answered 33 mins ago









        Rob Arthan

        29k42866




        29k42866






















            hoverless is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            hoverless is a new contributor. Be nice, and check out our Code of Conduct.













            hoverless is a new contributor. Be nice, and check out our Code of Conduct.












            hoverless is a new contributor. Be nice, and check out our Code of Conduct.
















            Thanks for contributing an answer to Mathematics Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3050591%2fexcess-axioms-in-the-definition-of-a-metric%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)